# [R] Vernier Caliper function vernier()

From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>
Date: Sat 02 Apr 2005 - 06:31:39 EST

Hi Folks,

I don't think I'm up to implementing a function for drawing French Curves, as requested by "dream".

However, the discussion about it took me back so vividly to the old days that, paranormally, I felt once again the urge to ascertain magnitudes as it used to be, and should be, done.

I have therefore implemented, and hereby donate to the R community, a new function vernier() which implements the Venier Caliper.

vernier(pi+sqrt(.182))

By following the instructions you should find that the result is

x = 3 Units + 5 Tenths + 7 Hundredths

All best wishes,
Ted.

vernier <- function(x,n=10) {
dS<-1/n; dV<-((n-1)/n)*dS
U<-floor(x)
plot(c(0,U+2,U+2,0,0),c(0,0,2,2,0),type="l",

main="Vernier Caliper",xlab="",ylab="",axes=FALSE)   lines(c(0,U+2),c(1.5,1.5))

```  for(i in (0:(U+2))){lines(c(i,i),c(1.5,1.6))}
for(i in (0:4)){lines(U+5*dS*c(i,i),c(1.5,1.575))}
for(i in (0:20)){lines(U+dS*c(i,i),c(1.5,1.55))}
```
lines(c(x,x),c(1.5,1.0))
```  arrows(0,1.25,x,1.25)
arrows(x,1.25,0,1.25)
text(x/2,1.15,"x")
```

text(0.25,0.75,
"1: Count the main divisions of Standard Scale for Units",adj=0)
text(0.25,0.60,
"2: Count the minor divisions of Standard Scale for Tenths",adj=0)
text(0.25,0.45,
"3: Count Vernier divisions till coincidence for Hundredths",adj=0)
}

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861
```Date: 01-Apr-05                                       Time: 21:31:39
------------------------------ XFMail ------------------------------

______________________________________________
```
R-help@stat.math.ethz.ch mailing list