Skip to content
Prev 208968 / 398500 Next

export test results to csv

Thanks to all for your help.

So to answer all questions:
- "test" is indeed a list. With my real data:
 > str(test)
List of 3
  $ output : num [1:15, 1:6] 1 2 3 4 5 6 7 8 9 10 ...
   ..- attr(*, "dimnames")=List of 2
   .. ..$ : NULL
   .. ..$ : chr [1:6] "con.num" "psihat" "p.value" "p.crit" ...
  $ con    : num [1:6, 1:15] 1 -1 0 0 0 0 1 0 -1 0 ...
  $ num.sig: int 0

- I want to export it to a csv file to save the results in a file that I 
will be able to edit. What I mean here is that for publications, I 
usually have the results from the statistic tests in a table. That is 
why I think that a csv file is the best option for me. However, I'm open 
to other suggestions! There might be better ways to save/store the results.

- So what I do now is:
 > write.csv(test[[1]], file="pbmcp.csv", append=F, quote=F, row.names=F)
 > write.csv(test[[2]], file="pbmcp.csv", append=T, quote=F, row.names=T)
 > write.csv(test[[3]], file="pbmcp.csv", append=T, quote=F, row.names=F)

I have then two other questions:
- I would like the name of each element of the list to appear too. How 
should I do it? I can do:
 > write.csv(names(test)[[3]], file="pbmcp.csv", append=T, quote=F, 
row.names=F)
But there might be an easier way.
- It is not so complicated to run these lines, but I thought there might 
be a simpler and more compact way to do it.

Thanks in advance for your help
Ivan


Le 2/5/2010 07:57, Rub?n Roa a ?crit :