Re: [R] Question on apply()

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Mon 18 Sep 2006 - 06:43:19 GMT

Hi

not much information about what can be wrong. As nobody knows your Xarray and SmoothList it is hard to guess. You even omitted to show what "does not work"
So here are few guesses.

predict usually expects comparable data
apply(Xarray, 2, NewValues,LIST=SmoothList)

HTH
Petr

On 18 Sep 2006 at 8:05, Gunther Höning wrote:

From:           	Gunther Höning <gunther.hoening@ukmainz.de>
To:             	<r-help@stat.math.ethz.ch>
Date sent:      	Mon, 18 Sep 2006 08:05:28 +0200
Subject:        	[R] Question on apply()

> 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
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.

Petr Pikal
petr.pikal@precheza.cz



R-help@stat.math.ethz.ch 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. Received on Mon Sep 18 16:48:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 18 Sep 2006 - 08:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.