From: Jim Lemon <bitwrit_at_ozemail.com.au>

Date: Sat 03 Dec 2005 - 06:09:43 EST

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 Fri Dec 02 19:01:03 2005

Date: Sat 03 Dec 2005 - 06:09:43 EST

Eric C. Jennings wrote:

*> To start with, pardon my mistake regarding "two vectors"
**>
**> Yes I want all values (to two decimal digits if I can) between each of
**> the values given in the vector.
**> meaning I'm really try to do something like this:
**> y<- c(0.4 : 0.0 : 0.2 : -0.2 : 0.6 : 0.2 : 0.0 : 0.0 : 0.4 : 0.4 : 0.2)
**> which of course does not work. (But on this point, something like m<-
*

> c(0.2:-0.6) doesn't work either.

*>
*

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

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 Fri Dec 02 19:01:03 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:41:28 EST
*