r - knitr updated from 1.2 to 1.4 error: Quitting from lines -
i updated knitr 1.4, , since .rnw files don't compile. document rich (7 chapters, included child=""). now, in recent knitr version error message:
quitting lines 131-792 (/daten/anna/tex/costa/chapter1.rnw) quitting lines 817-826 (/daten/anna/tex/costa/chapter1.rnw) fehler in if (eval) { : argument kann nicht als logischer wert interpretiert werden
(the last 2 lines mean knitr looking logical , cannot find it. @ lines 131 , 817 2 figures end. compiling these sniplets separately work. have no idea how resolve problem. thank's in advance hints allow resolve issue.
here sessioninfo()
r version 2.15.1 (2012-06-22) platform: x86_64-pc-linux-gnu (64-bit) locale: [1] lc_ctype=de_de.utf-8 lc_numeric=c [3] lc_time=de_de.utf-8 lc_collate=de_de.utf-8 [5] lc_monetary=de_de.utf-8 lc_messages=de_de.utf-8 [7] lc_paper=c lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=de_de.utf-8 lc_identification=c attached base packages: [1] tools stats graphics grdevices utils datasets methods [8] base other attached packages: [1] knitr_1.4 loaded via namespace (and not attached): [1] compiler_2.15.1 digest_0.6.3 evaluate_0.4.7 formatr_0.9 [5] stringr_0.6.2 tcltk_2.15.1
following suggestions of hui, run each chapter separately knit("chapter1.rnw") , on. no error message occurs, , separate tex files created. provide more information display part of code. there main document in several options set
<<options-setting,echo=false>>= showthis <- false evalthis <- false evalchapter <- true opts_chunk$set(comment=na, fig.width=6, fig.height=4) @
the each chapter used via child chunks, e.g. chapter1 called from
<<child-chapter1, child='chapter1.rnw', eval=evalchapter>>= @
the error message appears when knitting main rnw file given above. related figure environment follows
\begin{figure}[ht] \centering <<wuerfel-simulation,echo=showthis,fig.height=5>>= data.sample6 <- sample(1:6,repl=true,100) table(data.sample6) barplot(table(data.sample6)/100,col=5,main="haeufigkeiten beim wuerfeln") @ \caption{visualisierung beim w"urfeln. 100 versuche.} \label{fig:muent-vis} \end{figure}
this not advanced, error still given before. quitting lines concerns long text, 131 (end of first chunk) line 792 (beginning of followup chunk), is
<< zeiten, echo=showthis,eval=evalthis>>= zeiten <- c(17,16,20,24,22,15,21,15,17,22) max(zeiten) mean(zeiten) zeiten[4] <- 18; zeiten mean(zeiten) sum(zeiten > 20) @
is there problem correctly closing chunk?
i located error , provide short piece of code reproducible error message.it concerns conditional evaluation of child processes involving sexpr:
the main file following
\documentclass{article} \begin{document} <<options-setting,echo=false>>= evalchapter <- true @ <<test,child="test-child.rnw", eval=evalchapter>>= @ \end{document}
the related child file 'test-child.rnw' is
<<no-sexpr>>= t <- 2:4 @ text \sexpr{(t <- 2:4)}
knitting 'as is' gives error message above. removing sexpr in child works nicely. but, works nicely, if remove conditioning in call of child file, i.e., without 'eval=evalchapter'
since use sexpr quite have solution problem. mentioned earlier, there no problems knitr version 1.2.
this related change in knitr 1.3 , mentioned in news:
added argument
options
knit_child()
set global chunk options child documents; if parent chunk calls child document (viachild
option), chunk options of parent chunk used global options child document, e.g.<<foo, child='bar.rnw', fig.path='figure/foo-'>>=
, figure path prefixfigure/foo-
inbar.rnw
; see how avoid figure filenames in child calls application
and caused bug inline r code. in case, chunk option eval=evalchapter
not evaluated when used evaluating inline code. have fixed bug in development version v1.4.5 on github.