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, rhelp at conference.jabber.org r 251 (27-06-07) mandriva 2008
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.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of e-letter > Sent: Thursday, January 08, 2009 9:22 AM > To: r-help at 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, > > rhelp at conference.jabber.org > > r 251 (27-06-07) > mandriva 2008 > > ______________________________________________ > R-help at 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.
David Winsemius
2009-Jan-13 18:24 UTC
[R] Default browser was Re: interpolation to abscissa
On Jan 8, 2009, at 11:22 AM, e-letter wrote:> 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?)Look at options()$browser and reconfigure if necessary. > options()$browser [1] "/usr/bin/open" or... > options("browser") $browser [1] "/usr/bin/open Which means that the default is set by my system configuration. I had earlier followed some advice offered me in a warning and changed the default pdf viewer configuration, which should be an easy-to-rejigger example: > options("eps_view"= "/Applications/Preview.app") -- David Winsemius