Re: [R] Error while trying to save summary() output as csv
Thank you David, thank you Ista - as.matrix solves the problem. Best regards, Kamil Sijko +48.790.818.212 2010/3/22 David Winsemius : > > On Mar 22, 2010, at 3:06 PM, Ista Zahn wrote: > >> Hi Kamil, >> You can use something like >> write.csv(t(as.matrix(object)), file="name.csv") >> >> -Ista >> On Mon, Mar 22, 2010 at 2:54 PM, Kamil Sijko >> wrote: >>> >>> Hi, >>> >>> I need to save output of summary() procedure to a csv file. It's all >>> OK when it's applied to a 'factor' class variable, but when I try to >>> save a 'integer' class summary to csv it gives me : >>> summary(rnorm(100, 10)) -> object write.csv2(object, file='name.csv') >>> >>> Error in do.call("expand.grid", c(dimnames(x), stringsAsFactors = >>> stringsAsFactors)) : >>> second argument must be a list >>> >>> It's the same when I use write.csv instead of write.csv2 >>> >>> summary() produces a very simple table: >>> >>> structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c("Min.", >>> "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), class = "table") >>> >>> I have no idea, what to do... So Group, please help me: what does this >>> error mean, and how to cope with it? > > Not sure why you got that error but if you convert that table into a matrix > the writing proceeds as expected: > > write.csv(as.matrix(structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), > .Names = c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), class = > "table") ), file="test.csv") > > > -- > David. >>> >>> Thanks for your help. >>> Kamil >>> >>> __ >>> R-help@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. >>> >> >> >> >> -- >> Ista Zahn >> Graduate student >> University of Rochester >> Department of Clinical and Social Psychology >> http://yourpsyche.org >> >> __ >> R-help@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. > > __ R-help@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.
Re: [R] Error while trying to save summary() output as csv
On Mar 22, 2010, at 3:06 PM, Ista Zahn wrote: Hi Kamil, You can use something like write.csv(t(as.matrix(object)), file="name.csv") -Ista On Mon, Mar 22, 2010 at 2:54 PM, Kamil Sijko wrote: Hi, I need to save output of summary() procedure to a csv file. It's all OK when it's applied to a 'factor' class variable, but when I try to save a 'integer' class summary to csv it gives me : summary(rnorm(100, 10)) -> object write.csv2(object, file='name.csv') Error in do.call("expand.grid", c(dimnames(x), stringsAsFactors = stringsAsFactors)) : second argument must be a list It's the same when I use write.csv instead of write.csv2 summary() produces a very simple table: structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), class = "table") I have no idea, what to do... So Group, please help me: what does this error mean, and how to cope with it? Not sure why you got that error but if you convert that table into a matrix the writing proceeds as expected: write.csv(as.matrix(structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c("Min.", "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), class = "table") ), file="test.csv") -- David. Thanks for your help. Kamil __ R-help@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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@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. __ R-help@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.
Re: [R] Error while trying to save summary() output as csv
Hi Kamil, You can use something like write.csv(t(as.matrix(object)), file="name.csv") -Ista On Mon, Mar 22, 2010 at 2:54 PM, Kamil Sijko wrote: > Hi, > > I need to save output of summary() procedure to a csv file. It's all > OK when it's applied to a 'factor' class variable, but when I try to > save a 'integer' class summary to csv it gives me : > >> summary(rnorm(100, 10)) -> object >> write.csv2(object, file='name.csv') > Error in do.call("expand.grid", c(dimnames(x), stringsAsFactors = > stringsAsFactors)) : > second argument must be a list > > It's the same when I use write.csv instead of write.csv2 > > summary() produces a very simple table: > > structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c("Min.", > "1st Qu.", "Median", "Mean", "3rd Qu.", "Max."), class = "table") > > I have no idea, what to do... So Group, please help me: what does this > error mean, and how to cope with it? > > Thanks for your help. > Kamil > > __ > R-help@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. > -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@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.