[R] how do I exort a list of numbers into csv file?

baptiste auguie baptiste.auguie at googlemail.com
Mon Feb 6 03:54:19 CET 2012


Hi,

If you don't mind having NAs for missing values, try the following,

mylist = list(1:3, 4:7)
library(plyr)
write.csv(do.call(rbind.fill.matrix, lapply(mylist, matrix, nrow=1)), file="")

HTH,

b.

On 6 February 2012 15:01, Michael <comtech.usa at gmail.com> wrote:
> Hi all,
>
> I have a list of vector of numbers - the reason I used list of vector was
> that I each list have different numbers of numbers which I don't know
> before run-time.
>
> mylist[[1]]  = c(1, 2, 3)
> mylist[[2]] = c (3, 4, 5, 6)
> ...
> ...
> etc.
>
> Could you please tell me if there is a way to dump all these at once into
> csv file such that each row correspond to a vector or a cell of the list as
> shown above?
>
> Thanks a lot!
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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