Re: [R] knitr error with Lyx
Hi, Yihui, Attached is an HTML Diff report of the two files. The left pane contains the R-2.15.0 file. Thanks. --Mark From: Yihui Xie To: Mark Lamias Cc: "r-help@r-project.org" Sent: Thursday, November 29, 2012 2:43 PM Subject: Re: [R] knitr error with Lyx That is very helpful! Just to continue debugging, can you save the two versions of the tex files produced from LyX with different versions of R and do a diff on them? It sounds like something has changed from R 2.15.0 to 2.15.2. Regards, Yihui -- Yihui Xie 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 1:26 PM, Mark Lamias wrote: > Thanks, Yihui! > > Luckily I kept R-2.15.0 and left it untouched (so I can continue to use that > for now). If it helps any, I was able to go back into Lyx and change the > path to point to R-2.15.0 and I also changed the windows path environment > variable to point to the old version. After doing this, LyX worked fine > with no problem on the code below. Changing the paths back to the new > version R-2.15.2, generates the error below. > > If anyone else has any idea how to resolve this, either through R or a > Lyx/LaTeX fix, I'd be all ears. > > Thanks, again for your response, Yihui! > > > Sincerely yours, > > Mark J. Lamias C:\Users\Mark\Desktop\Test\2.15.0.tex C:\Users\Mark\Desktop\Test\2.15.2.tex \batchmode \batchmode \makeatletter \makeatletter \def\input@path{{C:/Users/Mark/Desktop//}} \def\input@path{{C:/Users/Mark/Desktop//}} \makeatother \makeatother \documentclass{article} \documentclass{article}\usepackage{graphicx, color} \usepackage{graphicx, color} %% maxwidth is the original width if it is less than linewidth %% otherwise use linewidth (to make sure the graphics do not exceed the margin) \makeatletter \def\maxwidth{ % \ifdim\Gin@nat@width>\linewidth \linewidth \else \Gin@nat@width \fi } \makeatother \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \definecolor{fgcolor}{rgb}{0.2, 0.2, 0.2} \newcommand{\hlnumber}[1]{\textcolor[rgb]{0,0,0}{#1}}% \newcommand{\hlnumber}[1]{\textcolor[rgb]{0,0,0}{#1}}% \newcommand{\hlfunctioncall}[1]{\textcolor[rgb]{.5,0,.33}{\textbf{#1}}}% \newcommand{\hlfunctioncall}[1]{\textcolor[rgb]{0.501960784 313725,0,0.329411764705882}{\textbf{#1}}}% \newcommand{\hlstring}[1]{\textcolor[rgb]{.6,.6,1}{#1}}% \newcommand{\hlstring}[1]{\textcolor[rgb]{0.6,0.6,1}{#1}}% \newcommand{\hlkeyword}[1]{\textbf{#1}}% \newcommand{\hlkeyword}[1]{\textcolor[rgb]{0,0,0}{\textbf{#1}}}% \newcommand{\hlargument}[1]{\textcolor[rgb]{.69,.25,.02}{#1}}% \newcommand{\hlargument}[1]{\textcolor[rgb]{0.6901960784313 73,0.250980392156863,0.0196078431372549}{#1}}% \newcommand{\hlcomment}[1]{\textcolor[rgb]{.18,.6,.34}{#1}}% \newcommand{\hlcomment}[1]{\textcolor[rgb]{0.18039215686274 5,0.6,0.341176470588235}{#1}}% \newcommand{\hlroxygencomment}[1]{\textcolor[rgb]{.44,.48,.7}{#1}}% \newcommand{\hlroxygencomment}[1]{\textcolor[rgb]{0.4392156 8627451,0.47843137254902,0.701960784313725}{#1}}% \newcommand{\hlformalargs}[1]{\hlargument{#1}}% \newcommand{\hlformalargs}[1]{\textcolor[rgb]{0.69019607843 1373,0.250980392156863,0.0196078431372549}{#1}}% \newcommand{\hleqformalargs}[1]{\hlargument{#1}}% \newcommand{\hleqformalargs}[1]{\textcolor[rgb]{0.690196078 431373,0.250980392156863,0.0196078431372549}{#1}}% \newcommand{\hlassignement}[1]{\textbf{#1}}% \newcommand{\hlassignement}[1]{\textcolor[rgb]{0,0,0}{\textbf{#1}}}% \newcommand{\hlpackage}[1]{\textcolor[rgb]{.59,.71,.145}{#1}}% \newcommand{\hlpackage}[1]{\textcolor[rgb]{0.58823529411764 7,0.709803921568627,0.145098039215686}{#1}}% \newcommand{\hlslot}[1]{\textit{#1}}% \newcommand{\hlslot}[1]{\textit{#1}}% \newcommand{\hlsymbol}[1]{#1}% \newcommand{\hlsymbol}[1]{\textcolor[rgb]{0,0,0}{#1}}% \newcommand{\hlprompt}[1]{\textcolor[rgb]{.5,.5,.5}{#1}}% \newcommand{\hlprompt}[1]{\textcolor[rgb]{0.2,0.2,0.2}{#1}}% \usepackage{color}% \newsavebox{\hlnormalsizeboxclosebrace}% \newsavebox{\hlnormalsizeboxopenbrace}% \newsavebox{\hlnormalsizeboxbackslash}% \newsavebox{\hlnormalsizeboxlessthan}% \newsavebox{\hlnormalsizeboxgreaterthan}% \newsavebox{\hlnormalsizeboxdollar}% \newsavebox{\hlnormalsizeboxunderscore}% \newsavebox{\hlnormalsizeboxand}% \newsavebox{\hlnormalsizeboxhash}% \newsavebox{\hlnormalsizeboxat}% \newsavebox{\hlnormalsizeboxpercent}% \newsavebox{\hlnormalsizeboxhat}% \newsavebox{\hlnormalsizeboxsinglequote}% \newsavebox{\hlnormalsizeboxbacktick}% \setbox\hlnormalsizeboxopenbrace=\hbox{\begin{normalsize}\v erb.{.\end{normalsize}}% \setbox\hlnormalsizeboxclosebrace=\hbox{\begin{norm
Re: [R] knitr error with Lyx
That is very helpful! Just to continue debugging, can you save the two versions of the tex files produced from LyX with different versions of R and do a diff on them? It sounds like something has changed from R 2.15.0 to 2.15.2. Regards, Yihui -- Yihui Xie 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 1:26 PM, Mark Lamias wrote: > Thanks, Yihui! > > Luckily I kept R-2.15.0 and left it untouched (so I can continue to use that > for now). If it helps any, I was able to go back into Lyx and change the > path to point to R-2.15.0 and I also changed the windows path environment > variable to point to the old version. After doing this, LyX worked fine > with no problem on the code below. Changing the paths back to the new > version R-2.15.2, generates the error below. > > If anyone else has any idea how to resolve this, either through R or a > Lyx/LaTeX fix, I'd be all ears. > > Thanks, again for your response, Yihui! > > > Sincerely yours, > > Mark J. Lamias __ 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] knitr error with Lyx
Thanks, Yihui! Luckily I kept R-2.15.0 and left it untouched (so I can continue to use that for now). If it helps any, I was able to go back into Lyx and change the path to point to R-2.15.0 and I also changed the windows path environment variable to point to the old version. After doing this, LyX worked fine with no problem on the code below. Changing the paths back to the new version R-2.15.2, generates the error below. If anyone else has any idea how to resolve this, either through R or a Lyx/LaTeX fix, I'd be all ears. Thanks, again for your response, Yihui! Sincerely yours, Mark J. Lamias From: Yihui Xie Cc: "r-help@r-project.org" Sent: Thursday, November 29, 2012 2:02 PM Subject: Re: [R] knitr error with Lyx 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 Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA > 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: > > <>= > #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? > [[elided Yahoo spam]] > > Sincerely yours, > > Mark J. Lamias > [[alternative HTML version deleted]] > > > __ > 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. > [[alternative HTML version deleted]] __ 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] knitr error with Lyx
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 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 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: > > <>= > #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@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.