Re: [R] values in between

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Thu 01 Dec 2005 - 19:18:26 EST

>>>>> "Eric" == Eric C Jennings <matheric@u.washington.edu>
>>>>> on Wed, 30 Nov 2005 21:39:12 -0800 writes:

    Eric> Hey there
    Eric> I have two vectors:

    Eric> y<- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2)

hmm, this is *one* vector , not two !

    Eric> In the vector y, I want to access (in the order given) all of the values in     Eric> between each of the specific values of given.

    Eric> I understand subsetting with y[i], but how do I get to ssomewhere in     Eric> between -0.6 and 0.2?

Though you could be much clearer, in your question, I'm pretty sure you are looking for *interpolation*; In that case, I'd recommend approx() or spline() -- or with same functionality but more elegant interface -- approxfun() and splinefun().

Martin Maechler, ETH Zurich



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 Thu Dec 01 19:25:05 2005

This archive was generated by hypermail 2.1.8 : Thu 01 Dec 2005 - 23:32:56 EST