[R] interpolation to abscissa

e-letter inpost at gmail.com
Thu Jan 8 17:22:28 CET 2009


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




More information about the R-help mailing list