I'm using knitr
to create LaTeX
documents with integrated R
code. Now I'd like to readout some external parameters (saved in a TXT or CSV file) and create a document based on the conditions specified within this document. E.g., within the CSV-File there might be something like:
documenttype \t report1
and there might be more than two types of reports (e.g. report1, report2, report3, report4, report5). Then I'd have to readout the document type(s) from the CSV-file and execute different LaTeX code based on the report type (I might save the LaTeX code e.g. in files report1.rnw, report2.rnw etc. and call the right one from the main document). I've read that etoolbox
provides a way to set conditional flags. However, can I set those flags based on the content of a CSV- or TXT-file? So can I first read out the content of another file, extract the flag and then execute other files based on those conditions (which are not just true or false, but really different flags)? Or do I have to do it first in R
and then execute the corresponding knitr-files in R
that in turn call different R
source files as code chunks?