How to write an if-then statement in LaTeX using the value of an R variable in knitr/Sweave -


i using knitr along r 3.0.2 , rstudio in order produce latex report. report typed .rnw file, , compiled using knit2pdf function.

i use if-then formulation in latex in order create separate section, have if-then condition use value of variable r (let's call createoptionalsection).

is possible? if so, how can refer r variable in .tex document?

add \usepackage{comment} preamble of latex file.

at line before optional section starts, do

<<startcomment, results='asis', echo=false>>= if(!createoptionalsection){   cat("\\begin{comment}") } @ 

at line after optional section ends, do

<<endcomment, results='asis', echo=false>>= if(!createoptionalsection){   cat("\\end{comment}") } @ 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -