[R] What am I doing wrong with this loop ?

From: eric <ericstrom_at_aol.com>
Date: Wed, 02 Mar 2011 19:19:22 -0800 (PST)

What is wrong with this loop ? I am getting an error saying incorrect number of dimensions y[i,2]

x <- as.data.frame(runif(2000, 12, 38))
z <-numeric(length(x))
y <- as.data.frame(z)

for(i in 1:length(x)) {
  y <- ifelse(i < 500, as.data.frame(lowess(x[1:i,1], f=1/9)) , as.data.frame(lowess(x[(i-499):i,1], f=1/9)))   z[i] <-y[i,2]
View this message in context: http://r.789695.n4.nabble.com/What-am-I-doing-wrong-with-this-loop-tp3332703p3332703.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Mar 2011 - 04:06:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Mar 2011 - 03:30:19 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.

list of date sections of archive