[R] Question about for loop?

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Mar 30 09:32:44 CEST 2006


Andris Jankevics wrote:

> Hello useRs,
> 
> I can't figure out how can I store a data frame of values of X and D  from 
> this loop:
> 
> Z <- c(1:10)
> 
> for (i in 1:(length(Z)-2)) 
> 	{D <- x[1:(2+i)]; 
> 	X <- paste("x",sep="",i)
> 	print (X)
> 	print (D)
> 	}


Assign them as elements of a list, for example.
For further reference what a list is:

 > PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html


Uwe Ligges


> 
> Thank You,
> 
> Andris Jankevics
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list