[R] how to put the results of loop into a dataframe

John Fox jfox at mcmaster.ca
Tue Jun 20 08:08:45 CEST 2006


Dear Zhi Jie, Zhang,

This problem seems so straightforward that I wonder whether I
misunderstand what you want:

x <- runif(100)
y <- x + 1
z <- x + y
Data <- data.frame(x, y, z)

I hope this helps,
 John

On Tue, 20 Jun 2006 09:09:16 +0800
 "zhijie zhang" <epistat at gmail.com> wrote:
> Dear friends,
>  suppose i want to do the following caulation for 100 times, how to
> put the
> results of x , y and z into the same dataframe/dataset?
> x<-runif(1)
> y<-x+1
> z<-x+y
> 
> thanks in advance!
> -- 
> Kind Regards,
> Zhi Jie,Zhang ,PHD
> Department of Epidemiology
> School of Public Health
> Fudan University
> Tel:86-21-54237149
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/



More information about the R-help mailing list