I will swallow my pride and post to this list for the second time in 24 hours--I have a paper due to a reviewer and I am desperate. Has anybody written code to move the output from "summary()" called on the results of a zeroinfl() model (from the pscl package) into a form suitable for publication? When I hit send on this message I am going to begin hand typing stars into a spreadsheet. The problem is that the zero-inflated model has two parts: a count and a zero portion--its coefficients are stored in separate arrays and there is a Log(theta) that needs to be thrown in there that is in a completely separate place in the structure of the summary function. As a result the functions that I have found for outputting summaries of other linear models all give error messages when attempted on this summary object. My ideal would be to gather the information onto the clipboard so I could paste it into Excel and do the formatting there, but any approach would be better than what I have now. Thanks, Chris
Hi Chris,>> My ideal would be to gather the information onto the clipboard so I >> could paste it into Excel and do the formatting there, but any approach >> would be better than what I have now.I would never use Excel for this since there are far superior tools available. But it is very easy to assemble the two parts into a single table for further manipulation. Not sure about the clipboard route, but the following rather crude approach saves the object (a list) to a *.csv file in your working directory. ## Simple, crude approach, with theta replicated as last column in the saved *.csv data("bioChemists", package = "pscl") fm_zinb <- zeroinfl(art ~ . | 1, data = bioChemists, dist = "negbin") Temptab <- list(coef=rbind(summary(fm_zinb)$coefficients[[1]], summary(fm_zinb)$coefficients[[2]]), theta=fm_zinb$theta) getwd() write.csv(Temptab, file="Temptab.csv") read.csv("Temptab.csv") ## If you have a latex distribution library(Hmisc) latex(list(coef=rbind(summary(fm_zinb)$coefficients[[1]], summary(fm_zinb)$coefficients[[2]]), theta=fm_zinb$theta), cdec=c(3,3,3,4,3)) Regards, Mark. Chris Fowler wrote:> > I will swallow my pride and post to this list for the second time in 24 > hours--I have a paper due to a reviewer and I am desperate. > > Has anybody written code to move the output from "summary()" called on > the results of a zeroinfl() model (from the pscl package) into a form > suitable for publication? > > When I hit send on this message I am going to begin hand typing stars > into a spreadsheet. > > The problem is that the zero-inflated model has two parts: a count and a > zero portion--its coefficients are stored in separate arrays and there > is a Log(theta) that needs to be thrown in there that is in a completely > separate place in the structure of the summary function. As a result the > functions that I have found for outputting summaries of other linear > models all give error messages when attempted on this summary object. > > My ideal would be to gather the information onto the clipboard so I > could paste it into Excel and do the formatting there, but any approach > would be better than what I have now. > > Thanks, > > Chris > > ______________________________________________ > 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. > >-- View this message in context: http://old.nabble.com/a-publication-quality-table-for-summary.zeroinfl%28%29-tp26140199p26140542.html Sent from the R help mailing list archive at Nabble.com.
Chris, If you want to go the clipboard route, use write.table(): d1 <- coef(summary(fm_zip2))$count d2 <- coef(summary(fm_zip2))$zero d <- rbind(d1, rep(NA, 4), d2) write.table(d, file="clipboard", col.names=NA, sep="\t") Now paste into Excel. -Peter Ehlers Mark Difford wrote:> Hi Chris, > >>> My ideal would be to gather the information onto the clipboard so I >>> could paste it into Excel and do the formatting there, but any approach >>> would be better than what I have now. > > I would never use Excel for this since there are far superior tools > available. But it is very easy to assemble the two parts into a single table > for further manipulation. Not sure about the clipboard route, but the > following rather crude approach saves the object (a list) to a *.csv file in > your working directory. > > ## Simple, crude approach, with theta replicated as last column in the saved > *.csv > data("bioChemists", package = "pscl") > fm_zinb <- zeroinfl(art ~ . | 1, data = bioChemists, dist = "negbin") > Temptab <- list(coef=rbind(summary(fm_zinb)$coefficients[[1]], > summary(fm_zinb)$coefficients[[2]]), theta=fm_zinb$theta) > getwd() > write.csv(Temptab, file="Temptab.csv") > read.csv("Temptab.csv") > > ## If you have a latex distribution > library(Hmisc) > latex(list(coef=rbind(summary(fm_zinb)$coefficients[[1]], > summary(fm_zinb)$coefficients[[2]]), theta=fm_zinb$theta), > cdec=c(3,3,3,4,3)) > > Regards, Mark. > > > > Chris Fowler wrote: >> I will swallow my pride and post to this list for the second time in 24 >> hours--I have a paper due to a reviewer and I am desperate. >> >> Has anybody written code to move the output from "summary()" called on >> the results of a zeroinfl() model (from the pscl package) into a form >> suitable for publication? >> >> When I hit send on this message I am going to begin hand typing stars >> into a spreadsheet. >> >> The problem is that the zero-inflated model has two parts: a count and a >> zero portion--its coefficients are stored in separate arrays and there >> is a Log(theta) that needs to be thrown in there that is in a completely >> separate place in the structure of the summary function. As a result the >> functions that I have found for outputting summaries of other linear >> models all give error messages when attempted on this summary object. >> >> My ideal would be to gather the information onto the clipboard so I >> could paste it into Excel and do the formatting there, but any approach >> would be better than what I have now. >> >> Thanks, >> >> Chris >> >> ______________________________________________ >> 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. >> >> >