I am working on a knitr-sweave document and have found that global R options like
par(lwd=3)
and
strOptions(strict.width='cut')
do not take effect in later code chunks. I can specify these options as arguments each time I plot() or str(), so it's not a huge problem. I'm just wondering if anyone has any insight into this. Should I be caching the code chunk where I set these options? I call some libraries in early code chunks and set variables in others and they all seem to be accessible "globally" (i.e. in later code chunks).
The format is par(optionname=value, optionname=value, ...) A second way to specify graphical parameters is by providing the optionname=value pairs directly to a high level plotting function. In this case, the options are only in effect for that specific graph.
Parameters in an R Markdown document are very simple to use. In the yaml header (the section at the top of the markdown document), you just have to add a couple new lines for your parameters to hardcode them in. Once they're coded in, they will be available in the params object for use in the rest of the analysis.
I believe I can help you with setting strOptions
globally. Just set your str
options as a list under options
, like this:
options(str = list(strict.width = "cut"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With