If you want to just linearly interpolate, then use the functions approx or 
approxfun from the stats package (one of those that is loaded by default).  See 
the function TkApprox in the TeachingDemos package for an interactive way to 
plot the approximations with the interpolations plotted.  

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of e-letter
> Sent: Thursday, January 08, 2009 9:22 AM
> To: r-help@r-project.org
> Subject: [R] interpolation to abscissa
> 
> Readers,
> 
> I have looked at various documents hosted on the web site; I couldn't
> find anything on interpolation. So I started r and accessed the help
> (help.start()). (by the way is it possible to configure r to open help
> in opera instead of firefox?) Initially I read the help for the akima
> package but couldn't understand it. Next I tried the asplines package
> help.
> 
> I tried to copy the example: x<-c(-3,-2,...
> 
> I realised that the 'n=...' parameter determines the resolution of the
> line, so I practised the following subsequent commands:
> 
> > x<-c(-3,-2,-1,0,1,2,2.5,3)
> > y<-c(0,0,0,0,-1,-1,0,2)
> > plot(x,y,ylim=c(-3,3))
> 
> I get the graph as expected
> 
> Then I enter further commands:
> 
> lines(spline(x,y,n=200),col="blue")
> lines(spline(x,y,n=20),col="blue")
> lines(spline(x,y,n=2),col="blue")
> lines(spline(x, y, n=5), col="blue")
> 
> >From this I learn that n corresponds to line resolution. :)
> 
> However I could not find a way to remove the last 3 commands and then
> show only the first line. How do I achieve this please?
> 
> I am learning this package in order to perform my next task;
> interpolation.
> 
> If I have a linear relationship between two variables and plot the
> results, how do I manipulate the graph to be able to show a value of
> the abscissa, especially for negative values, i.e. where the linear
> line intersects the x axis left of the y axis?
> 
> There are 4 packages that claim interpolation (akima, aspline, interp,
> interpp) but they seem far to complicated, especially the latter two.
> Is there a simpler package I could use?
> 
> Yours,
> 
> rh...@conference.jabber.org
> 
> r 251 (27-06-07)
> mandriva 2008
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to