[R] how to get f(x)=___ from a piecwise function

2006-02-25 Thread Eric C. Jennings
>From actual real-world readings, I have two vectors: x<- c(-100.4, 32.0, 99.8, 200.2, 300.6, 399.8, 500.0, 600.0, 699.6, 799.6, 899.8) 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, in the usual way constitute a continuous piecewise function. What I want to do is find a

Re: [R] how to get f(x)=___ from a piecwise function

2006-02-25 Thread jim holtman
?approxfun > x<- c(-100.4, 32.0, 99.8, 200.2, 300.6, 399.8, 500.0, 600.0, 699.6, 799.6, + 899.8) > y<- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2) > x.f <- approxfun(x,y) > x.f(356) [1] -0.1532258 On 2/25/06, Eric C. Jennings <[EMAIL PROTECTED]> wrote: > > >From actual real-world

Re: [R] how to get f(x)=___ from a piecwise function

2006-03-23 Thread Eric C. Jennings
Thanks. the approxfun command works great --matches exactly with computing each point-to-point slope Eric - Original Message - From: jim holtman To: Eric C. Jennings Cc: R-help Sent: Saturday, February 25, 2006 9:27 PM Subject: Re: [R] how to get f(x)=___ from a piecwise