[R] Hmisc summary.formula.reverse export problem
Dear R-users, I'm trying to export object taulu3 from R to a text file (separated with semicolon). Object taulu3 is made with summary.formula in Hmisc package: taulu3 <- summary(sp ~ pdg_newtext, data=tr_ekahj, method="reverse", overall=TRUE) class(taulu3) [1] "summary.formula.reverse" When I try to export the object taulu3, I get the following error message: write.table(taulu3, "O:/taulu1.txt", sep=";") Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class "summary.formula.reverse" into a data.frame How can I get this object exported properly? I'm using Windows XP and I don't know latex yet. Regards, Lauri [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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] Hmisc summary.formula.reverse export problem
Well, write.table works on 'tables', that is matrix-like objects. An object summary is not matrix-like. You may be looking for capture.output(print(taulu3), file="O:/taulu1.txt") On Fri, 30 Mar 2007, Lauri Nikkinen wrote: > Dear R-users, > > I'm trying to export object taulu3 from R to a text file (separated with > semicolon). Object taulu3 is made with summary.formula in Hmisc package: > > taulu3 <- summary(sp ~ pdg_newtext, data=tr_ekahj, method="reverse", > overall=TRUE) > class(taulu3) > [1] "summary.formula.reverse" > > When I try to export the object taulu3, I get the following error message: > > write.table(taulu3, "O:/taulu1.txt", sep=";") > > Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = > stringsAsFactors) : >cannot coerce class "summary.formula.reverse" into a data.frame > > How can I get this object exported properly? I'm using Windows XP and I > don't know latex yet. > > Regards, > Lauri > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch 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. > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch 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] Hmisc summary.formula.reverse export problem
Thanks Brian, I was trying to get that object printed out with columns separated by semicolon. The reason for this is that I'm trying to get it to MS Excel. If this is not possible, I probably should turn into using Latex. -Lauri 2007/3/30, Prof Brian Ripley <[EMAIL PROTECTED]>: > > Well, write.table works on 'tables', that is matrix-like objects. > An object summary is not matrix-like. > > You may be looking for > > capture.output(print(taulu3), file="O:/taulu1.txt") > > > On Fri, 30 Mar 2007, Lauri Nikkinen wrote: > > > Dear R-users, > > > > I'm trying to export object taulu3 from R to a text file (separated with > > semicolon). Object taulu3 is made with summary.formula in Hmisc package: > > > > taulu3 <- summary(sp ~ pdg_newtext, data=tr_ekahj, method="reverse", > > overall=TRUE) > > class(taulu3) > > [1] "summary.formula.reverse" > > > > When I try to export the object taulu3, I get the following error > message: > > > > write.table(taulu3, "O:/taulu1.txt", sep=";") > > > > Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors > = > > stringsAsFactors) : > >cannot coerce class "summary.formula.reverse" into a data.frame > > > > How can I get this object exported properly? I'm using Windows XP and I > > don't know latex yet. > > > > Regards, > > Lauri > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@stat.math.ethz.ch 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. > > > > -- > Brian D. Ripley, [EMAIL PROTECTED] > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UKFax: +44 1865 272595 > [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.