[R] knitr error with Lyx

Yihui Xie xie at yihui.name
Thu Nov 29 20:02:33 CET 2012


Quite a few people have had this problem, but since I'm unable to
reproduce it, I'm not exactly sure how to fix it either. A few
references that might be helpful to you:

http://stackoverflow.com/q/12448507/559676
https://github.com/yihui/knitr/issues/413

It is very likely to be a pure LaTeX problem. Letting MikTeX install
the missing LaTeX packages on the fly might solve the problem.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Thu, Nov 29, 2012 at 10:53 AM, Mark Lamias <mlamias at yahoo.com> wrote:
> R Users,
>
>
> I just upgraded my version of R from R-2.15.0 to R-2.15.2 and installed the latest versions of LyX and MikTex running Windows 7 Ultimate, 64-bit OS.  Prior to the upgrade, I was using Lyx with knitr to generate a document with no problems.  However, after the upgrade, and using the same LyX document, I'm receiving the following error when I attempt to compile the document:
>
> \end{verbatim}
> The control sequence at the end of the top line
> of your error message was never \def'ed. If you have
> misspelled it (e.g., `\hobx'), type `I' and the correct
> spelling (e.g., `I\hbox'). Otherwise just continue,
> and I'll forget about whatever was undefined.
>
> I have determined that the error is caused when printing the anova results from the anova statement in my R source code, but can't seem to resolve the issue.  Here is an example code chunk that creates the error:
>
> <<NonCP1, fig.width=6, fig.height=4, out.width='.8\\linewidth' ,par=FALSE>>=
> #Read in data
> y=c( 67, 73, 83, 89, 65, 91, 87, 86, 155, 127, 147, 212, 108, 100, 90, 153, 140, 142, 121, 150, 33, 8, 46, 54 )
> temp=as.factor(c(rep(seq(360, 380, 10), each=4), rep(seq(380, 360, -10), each=4)))
> coat=as.factor(rep(seq(1, 4), 6))
> replicate=as.factor(rep(seq(1, 6), each=4))
> #Obtain Factorial/Incorrect Model
> o=lm(y~temp*coat)
> ano=anova(o)
> ano
> @
>
>
> Removing the ano=anova(o) or ano lines in the code chunk allows the document to compile with no problem.  Does anyone else have this problem or did I do something wrong when I migrated to the newer versions?
>
> Thanks, in advance for any help!
>
> Sincerely yours,
>
> Mark J. Lamias
>         [[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.
>




More information about the R-help mailing list