Skip to content
Prev 82053 / 398506 Next

values in between

Eric C. Jennings wrote:
Hi Eric,

Okay, what you probably want is:

seq(0.4,0.0,by=0.01*sign(0.0-0.4))
...

This can be worked into the function that I posted, but it's getting a 
bit tricky to make it general. What you want to do is to "walk" through 
the values creating a sequence between each one with the above call.

in.betweens<-function(x,increment) {
  lenx<-length(x)
  newx<-x[1]
  for(i in 1:(lenx-1))
   newx<-c(newx,seq(x[i],x[i+1],by=increment*sign(x[i+1]-x[i]))[-1])
  return(zapsmall(newx))
}

Jim