[R] Question on apply()

Gunther Höning gunther.hoening at ukmainz.de
Mon Sep 18 08:05:28 CEST 2006


 Dear list,

I try to do the following:
I have an list of length n, with elements done by smooth.spline
(SmoothList).
Now I have a matrix with n rows and m columns with x-values(Xarray) 
Now I want ot predict the y-values.
Therefor I want to take the first element of SmoothList and the first row of
Xarray and predict for each element in Xarray the y value.
And then take the second element of SmoothList and second row of Xarray,
third row of SmoothList and third row of Xarray and so on....

I tried following:

NewValues <- function(x,LIST){predict(LIST,x)}
apply(Xarray, 2, NewValues,SmoothList)

But it don't work.

Could anybody help please ?

Gunther



More information about the R-help mailing list