[R] Odp: export test results to csv

Petr PIKAL petr.pikal at precheza.cz
Fri Feb 5 11:28:03 CET 2010


Hi

r-help-bounces at r-project.org napsal dne 04.02.2010 17:44:05:

> Hi everybody!
> 
> I would like to export the results of a test statistic in a *.csv file, 
> but get an error.
> The code is below.
> The data are attached as .txt with tab as separator. I tried to get a 
> sample dataset, but for some reason it didn't work, so please excuse the 

> length of the file. I also attached a txt with the output (copy/paste) 
> in case that helps.
> 
> ----
>  > library(WRS)
>  > ssfamed <- read.table(file=file.choose(), header=T, sep="\t")
>  > ssfa_Asfc <- fac2list(ssfa[,7], ssfa[3])  #store into list mode
>  > test <- pbmcp(ssfa_Asfc, alpha=0.05, nboot=2000, bhop=F)  #it takes 
> about 5 seconds to run
>  > write.csv(test, file="pbmcp.csv", append=F, quote=F, row.names=F)
> Error in data.frame(output = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,  :
>    arguments imply differing number of rows: 15, 6, 1
> ----
> 
> I guess it is because of the formatting of the "test" object and I 
> should reorganize it, but I actually have no idea how to do it.

You can recognize structure of object by

str(object)

> Tips would be greatly appreciated!

Structure of "test" output prevents to write test directly to csv.

You could save it in several sub files, each part of the list to a single 
file.

Regards
Petr

> 
> Thanks in advance
> Ivan
> 
> [příloha output.txt odstraněna uživatelem Petr PIKAL/CTCAP] [příloha 
> test_data.txt odstraněna uživatelem Petr PIKAL/CTCAP] 
> ______________________________________________
> 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