[R] Converting a list from R to Stata

2005-08-03 Thread Vicky Landsman

Dear all,
I have a list containing 150 simulated datasets in R. Is there a way to 
convert it to the Stata format such that I will be able to apply some Stata 
functions on each dataset in the list?
Thank you in advance,
Vicky Landsman.

__
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


Re: [R] Converting a list from R to Stata

2005-08-03 Thread Thomas Lumley
On Wed, 3 Aug 2005, Vicky Landsman wrote:


 Dear all,
 I have a list containing 150 simulated datasets in R. Is there a way to
 convert it to the Stata format such that I will be able to apply some Stata
 functions on each dataset in the list?

For Stata your best best is probably to stack all 150 datasets into one 
long data frame and add an id variable, so you can then -by id:- your 
analysis.
   big.data.frame - do.call(rbind, the.list.of.datasets)
will stack them for you and
   big.data.frame$id - rep(1:150, sapply(the.list.of.data.sets, nrow))
will make the id variable.

-thomas

__
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