Re: [R] Exporting a list of lists

2008-08-11 Thread Gabor Grothendieck
Try this: L <- list(list(Sku = "1", Shape = 1, Scale = 1, DayOfYear = 1:3), list(Sku = "2", Shape = 2, Scale = 2, DayOfYear = 2:3)) f <- function(x) { x$DayOfYear <- paste(x$DayOfYear, collapse = ","); x } write.table(do.call(rbind, lapply(L, f)), sep = ",", row.names = FALSE, file = "")

Re: [R] Exporting a list of lists

2008-08-11 Thread rkevinburton
I tried: cat("Sku,Shape,Scale,DayOfYear", file="SkuSalesInfo.dat", append=FALSE); for(i in 1:length(mlist)) { cat(mlist[[i]]$Sku, ",", mlist[[i]]$Shape, ",", mlist[[i]]$Scale, file="SkuSalesInfo.dat", append=TRUE) for(j in 1:length(mlist[[i]]$DayOfYear)) { cat(",", mlist[[i]]$D

Re: [R] Exporting a list of lists

2008-08-11 Thread rkevinburton
I would like to read it (the data) iinto a different application (not 'R'). Within 'R' I can mlist[[1]] > mlist[1] [[1]] [[1]]$Sku [1] "0" [[1]]$Shape [1] 250.0586 [[1]]$Scale [1] 91.9914 [[1]]$DayOfYear [1] 250 OR mlist[[2]] > mlist[[2]] $Sku [1] "18" $Shape [1] 178.9637 $Scale [1] 58

Re: [R] Exporting a list of lists

2008-08-11 Thread jim holtman
What do you want to do with the data? Are you just storing it to read in it later? Have you looked at 'save/load'? If you want a character representation, try 'dput'; this can be read back in with 'source'. So it all depends on what you are planning to do with it. On Mon, Aug 11, 2008 at 4:14 P

Re: [R] Exporting a list of lists

2008-08-11 Thread Roland Rau
Hi Kevin, check ?dump set.seed(1234) list1 <- list(a1=rnorm(100), a2=rnorm(10)) list2 <- list(a1=rnorm(50), a2=rnorm(25)) mylist <- list(top1=list1, top2=list2) dump(list="mylist", file="mydumpedlist.r") rm(mylist) # please note that you have to quote the name # of the object(s) you want to du

[R] Exporting a list of lists

2008-08-11 Thread rkevinburton
I have a list List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist) Note: picture daylist as c(2,3,4,3) it is a list with variable length. Then I have a list of lists al <- c(al, List(List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist)) Note: same comment on daylist as above. So far this creates a