Christopher W Ryan
2010-Oct-22 01:21 UTC
[R] trouble with \textless in Hmisc latex() on a drop1 object
Yes, it's homework . . . delete now if desired . . . but I think it is an interesting problem. Running R 2.11.1, LaTeX on WinXP, via Sweave. A drop1() object from a glm() produces, as part of its output, a string that looks like this: <none> The trouble I run into is that running latex() on a drop1() object from glm() produces a string that looks like this in the generated .tex file: \textlessnone\textgreater This gives an "undefined control sequence" error when compiling the .tex file. I can just <ENTER> past the error, but the resulting .pdf file contains just a greater-than symbol in the table where <none> is supposed to appear. If I go into the .tex file and manually insert a space, changng it to \textless none\textgreater the document compiles fine. Reproducile example below. Any suggestions? Thanks. Chris Ryan SUNY Upstate Medical University Binghamton Clinical Campus \documentclass{article} \begin{document} <<options, echo=FALSE, hide=TRUE>>options(SweaveSyntax = "SweaveSyntaxNoweb") library(Hmisc) @ <<code>>salmon <- data.frame(cbind(c(rep(0,49),rep(1,51)), rnorm(100), rnorm(100))) names(salmon) <- c("country","freshwater","marine") model1 <- glm(country~freshwater+marine, family="binomial", data=salmon) summary(model1) model1r <- round(drop1(model1),3) @ Here is some problem code. <<problemcode, results=tex>>latex(model1r, file="", caption="signficance of individual predictors") @ \end{document} [[alternative HTML version deleted]]
Duncan Murdoch
2010-Oct-22 01:33 UTC
[R] trouble with \textless in Hmisc latex() on a drop1 object
On 21/10/2010 9:21 PM, Christopher W Ryan wrote:> Yes, it's homework . . . delete now if desired . . . but I think it is an > interesting problem.Looks like a simple bug in Hmisc, leaving out that space. I'd grab a copy of the source, fix it, and send a patch to the maintainer (Charles Dupont <charles.dupont at vanderbilt.edu>, who is cc'd). Or, if you don't know how to do that, just write to the maintainer. Your example should be sufficient for him to find and fix it. But then you'll have to wait until he has time... Duncan Murdoch> > Running R 2.11.1, LaTeX on WinXP, via Sweave. > > A drop1() object from a glm() produces, as part of its output, a string that > looks like this: > > <none> > > The trouble I run into is that running latex() on a drop1() object from > glm() produces a string that looks like this in the generated .tex file: > > \textlessnone\textgreater > > This gives an "undefined control sequence" error when compiling the .tex > file. I can just<ENTER> past the error, but the resulting .pdf file > contains just a greater-than symbol in the table where<none> is supposed to > appear. > > If I go into the .tex file and manually insert a space, changng it to > > \textless none\textgreater > > the document compiles fine. > > Reproducile example below. Any suggestions? > > Thanks. > Chris Ryan > SUNY Upstate Medical University Binghamton Clinical Campus > > \documentclass{article} > \begin{document} > > <<options, echo=FALSE, hide=TRUE>>> options(SweaveSyntax = "SweaveSyntaxNoweb") > library(Hmisc) > @ > > <<code>>> salmon<- data.frame(cbind(c(rep(0,49),rep(1,51)), rnorm(100), rnorm(100))) > names(salmon)<- c("country","freshwater","marine") > model1<- glm(country~freshwater+marine, family="binomial", data=salmon) > summary(model1) > model1r<- round(drop1(model1),3) > @ > > Here is some problem code. > > <<problemcode, results=tex>>> latex(model1r, file="", caption="signficance of individual predictors") > @ > > \end{document} > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.