[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.

Its definition is below. Test it by entering


By following the instructions you should find that the result is

  x = 3 Units + 5 Tenths + 7 Hundredths

which is good enough for anyone. It generalises to non-decimal Vernier Calipers (change the default "n=10", but I leave it to you to work out how to deal with the texts).

All best wishes,

vernier <- function(x,n=10) {
  dS<-1/n; dV<-((n-1)/n)*dS

       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))}
  for(i in (1:20)){if(x+i*dV<=U+2){lines(x+c(i,i)*dV,c(1.5,1.45))}}   text(x+1/10,1.25,"Vernier",adj=0)

"1: Count the main divisions of Standard Scale for Units",adj=0)
"2: Count the minor divisions of Standard Scale for Tenths",adj=0)
"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
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Apr 02 07:56:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:00 EST