HI,
No problem.
I am using linux, may be there is a difference.
You could try this:
?for(i in seq_along(lst1))
write.table(lst1[[i]],file="Crish1.txt",append=TRUE,quote=FALSE,sep=",")
#Will get some warning message.
You can save .txt to .csv and open it in excel. The column headings would be
slightly misplaced.
A.K.
Thanks for replying Arun!
I tried the way you suggested. But all the elements are being
clumped together in a single coulumn and i could see no commas
separating them in csv file.
Is it a good idea to recursively collect the each element down the list and
print them separated by comma.
Krishna | Cytel
----- Original Message -----
From: arun <smartpink111 at yahoo.com>
To: R help <r-help at r-project.org>
Cc:
Sent: Tuesday, September 3, 2013 10:09 AM
Subject: Re: Writing list into csv file
Hi,
Please use dput() to show the example dataset:
Not sure this matches with your original example though..
lst1<- structure(list(Contrasts = structure(list(linear = c(-0.437,
-0.378, -0.201, 0.271, 0.743), emax1 = c(-0.799, -0.17, 0.207,
0.362, 0.399), emax2 = c(-0.643, -0.361, 0.061, 0.413, 0.53),
??? linInt = c(-0.894, 0.224, 0.224, 0.224, 0.224)), .Names =
c("linear",
"emax1", "emax2", "linInt"), class =
"data.frame", row.names = c("0",
"0.05", "0.2", "0.6", "1")), `Contrast
Correlation` = structure(list(
??? linear = c(1, 0.766, 0.912, 0.488), emax1 = c(0.766, 1, 0.949,
??? 0.893), emax2 = c(0.912, 0.949, 1, 0.719), linInt = c(0.488,
??? 0.893, 0.719, 1)), .Names = c("linear", "emax1",
"emax2",
"linInt"), class = "data.frame", row.names =
c("linear", "emax1",
"emax2", "linInt")), `Multiple Contrast Test` =
structure(list(
??? t.Stat = c(3.464, 3.339, 2.972, 2.486), adj.p = structure(1:4, .Label =
c("< 0.001",
??? "0.00143", "0.00459", "0.01610"), class =
"factor")), .Names = c("t.Stat",
"adj.p"), class = "data.frame", row.names =
c("emax2", "emax1",
"linear", "linInt"))), .Names = c("Contrasts",
"Contrast Correlation",
"Multiple Contrast Test"))
You may try:
capture.output(sapply(lst1,print),file="test.csv",append=TRUE)? #not
perfect as some headings might be misplaced.
A.K.
Hello Guys
?
Say I have ?a List MM with
Multiple Contrast Test
Contrasts:
? ? ?linear ?emax1 ?emax2 linInt
0 ? ?-0.437 -0.799 -0.643 -0.894
0.05 -0.378 -0.170 -0.361 ?0.224
0.2 ?-0.201 ?0.207 ?0.061 ?0.224
0.6 ? 0.271 ?0.362 ?0.413 ?0.224
1 ? ? 0.743 ?0.399 ?0.530 ?0.224
Contrast Correlation:
? ? ? ? ? ?linear emax1 emax2 linInt
linear ?1.000 0.766 0.912 ?0.488
emax1 0.766 1.000 0.949 ?0.893
emax2 0.912 0.949 1.000 ?0.719
linInt ? 0.488 0.893 0.719 ?1.000
Multiple Contrast Test:
? ? ? ?t-Stat ? adj-p
emax2 ? 3.464 < 0.001
emax1 ? 3.339 0.00143
linear ?2.972 0.00459
linInt ?2.486 0.01610
each element of MM has different number elements of diffrent
datatypes. I wanted write a single csv file containning all the
elements.
Is is possible to do in R.
Krishna | Cytel