[R] wapply from gplots -- How do I get a local estimate of variance?

From: Fredrik Karlsson <dargosch_at_gmail.com>
Date: Fri 17 Jun 2005 - 21:50:11 EST


Dear list,

I am trying to plot the local variance in a moving window on a dataset. The function that I am trying to use for this is wapply from gtools.

However, from the lattice panel function code:

<snip>

	cat(x)
	cat(y)
  	wapply(x,y,method="range",width=1/10,fun=sd,na.rm=TRUE) -> outvar

</snip>

I get:

<snip>

109 109 109 109 109 109 116 116 116 116 119 119 123 123 123 123 127 127 133 133 133 133 133 138 138 138 138 138 138 138 138138 138 138 142 142 142 142 142 142 142 147 147 147 147 147 158 158 158 158 158 158 158 158 158 158 158 158 158
20.234 28.431 10.762 45.613 15.028 10.775 18.516 13.371 18.516 13.371 20.61 31.08 9.338 210.77 11.927 39.438 -35.079 15.872 12.272 9.1122.665 7.355 22.057 -49.289 11.212 16.236 20.654 16.236 20.654

15.181 57.271 37.513 57.271 37.513 8.518 -108.517 -14.444 10.702 4.482
16.422 23.003 42.451 12.998 42.451 12.998 14.292 5.945 7.115 16.079
-13.172 10.62 16.079 -13.172 10.62 16.079 -13.172 10.62 20.477 22.656
Error in var(x, na.rm = na.rm) : 'x' is empty
</snip>

What am I doing wrong with this? The variables that I think is supplied to the var function does not seem to be empty like the error message suggests.

The gplots package is from the 2.0.7 version of the gregmisc bundle.

/Fredrik Karlsson



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 Received on Fri Jun 17 22:01:29 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:47 EST