[R] Odp: export results

Petr PIKAL petr.pikal at precheza.cz
Thu Feb 25 16:44:43 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 25.02.2010 12:42:46:

> 
> Hi all,
> 
> I am looping through a function for 100 time in the middle of my code, 
and I
> want to output the results from this function. Is there a way to write 
the
> results into a txt or csv fil? For example, I write the results from the
> first loop to the first column of a spreadsheet and the results from the
> second loop to the second coclumn of a spreadsheet etc.

make a data frame, let say res

res=as.data.frame(matrix(NA, n, 100)) #predefine data frame
 
for (i in ...) {

some stuff
res[,i] <- some function result
}

write.table(res,....)

Regards
Petr




> 
> Thank you very much, 
> Wendy 
> -- 
> View this message in context: 
http://n4.nabble.com/export-results-tp1568880p1568880.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list