Skip to content
Back to formatted view

Raw Message

Message-ID: <17294.45522.869459.740885@stat.math.ethz.ch>
Date: 2005-12-01T08:18:26Z
From: Martin Maechler
Subject: values in between
In-Reply-To: <000301c5f639$8f882440$733dd080@Victor1>

>>>>> "Eric" == Eric C Jennings <matheric at 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