问题
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).
回答1:
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"))
来源:https://stackoverflow.com/questions/23439274/how-can-i-set-graphical-parameters-par-and-structure-options-stroptions