Does anyone know how to export describe.by statistics to csv in R? I get this message:
estatistica <- describe.by(pag,list(pag$Jogo)
write.table(estatistica,file="H:/Myfile.csv",sep=",")
"Erro em as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) :
cannot coerce class ""by"" to a data.frame"
Since its such a general question, a general example would do.
Jogo Pais Numero
A Canada 1
B Canada 2
C Canada 1
D Canada 4
A Brazyl 6
B Brazyl 7
A France 1
B France 1
C France 2
D France 3
Function
describeBy()(this should be used instead ofdescrive.by()that is deprecated) produces list of data frame and therefore can't be written to file withwrite.table().To solve this problem one way would be to put all list elements into one data frame with
do.call()andrbind()and then write to file. This will make data frame where group names will be added before original variable names.