title: knitr updated from 1.2 to 1.4 error: Quitting from lines
body: <p>I recently updated knitr to 1.4, and since then my .Rnw files don't compile.
  The document is rich (7 chapters, included with child="").
  Now, in the recent knitr version I get an error message:</p>
  
  <pre><code>    Quitting from lines 131-792 (/DATEN/anna/tex/CoSta/chapter1.Rnw) 
      Quitting from lines 817-826 (/DATEN/anna/tex/CoSta/chapter1.Rnw) 
      Fehler in if (eval) { : 
      Argument kann nicht als logischer Wert interpretiert werden
  </code></pre>
  
  <p>(the last two lines mean that knitr is looking for a logical and it cannot find it.
  At those lines 131 and 817 two figures end. Compiling these sniplets separately will work.
  I have no idea how to resolve this problem.
  Thank's in advance for any hints that allow to resolve my issue.</p>
  
  <p>Here is the sessionInfo()</p>
  
  <pre><code>    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 a 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   
  </code></pre>
  
  <p>Following the suggestions of Hui, I run each chapter separately with 
           knit("chapter1.Rnw")
  and so on. No error message occurs, and separate tex files are created. To provide more information I display part of the code.
  There is a main document in which several options are set</p>
  
  <pre><code>     &lt;&lt;options-setting,echo=FALSE&gt;&gt;=
       showthis &lt;- FALSE
       evalthis &lt;- FALSE
       evalchapter &lt;- TRUE
       opts_chunk$set(comment=NA, fig.width=6, fig.height=4)
       @
  </code></pre>
  
  <p>The each chapter is used via child  chunks, e.g. chapter1 is called from</p>
  
  <pre><code>     &lt;&lt;child-chapter1, child='chapter1.Rnw', eval=evalchapter&gt;&gt;=
       @
  </code></pre>
  
  <p>The error message which appears when knitting the main Rnw file was given above.
  The related Figure environment is as follows</p>
  
  <pre><code>     \begin{figure}[ht]
         \centering
        &lt;&lt;wuerfel-simulation,echo=showthis,fig.height=5&gt;&gt;=
        data.sample6 &lt;- 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}
  </code></pre>
  
  <p>This is not very advanced, but the error is still as it was given before.
  The quitting from lines concerns a long text, from 131 (end of first chunk)  to line 792 (beginning of the followup chunk), which is</p>
  
  <pre><code>       &lt;&lt; zeiten, echo=showthis,eval=evalthis&gt;&gt;=
         zeiten &lt;- c(17,16,20,24,22,15,21,15,17,22)
         max(zeiten)
         mean(zeiten)
         zeiten[4] &lt;- 18; zeiten
         mean(zeiten)
         sum(zeiten &gt; 20)
         @
  </code></pre>
  
  <p>Is there a problem with correctly closing a chunk?</p>
  
  <p>I now located the error and I provide a short piece of code with reproducible error message.It concerns conditional evaluation of child processes involving Sexpr:</p>
  
  <p>The main file is the following</p>
  
  <pre><code>    \documentclass{article}
      \begin{document}
      &lt;&lt;options-setting,echo=FALSE&gt;&gt;=
      evalchapter &lt;- TRUE
      @
      &lt;&lt;test,child="test-child.Rnw", eval=evalchapter&gt;&gt;=
      @ 
      \end{document}
  </code></pre>
  
  <p>The related child file 'test-child.Rnw' is</p>
  
  <pre><code>     &lt;&lt;no-sexpr&gt;&gt;=
       t &lt;- 2:4
       @ 
       text \Sexpr{(t &lt;- 2:4)}
  </code></pre>
  
  <p>knitting this 'as is' gives the error message from above. Removing the Sexpr in the child everything works nicely.
  But, everything also works nicely, if I remove the conditioning in the call of the child file, i.e., without 'eval=evalchapter'</p>
  
  <p>Since I use Sexpr quite often I would like to have a solution to this problem. As I mentioned earlier, there were no problems up to knitR Version 1.2.</p>