How can I set graphical parameters (par()) and structure options (strOptions()) in a knitr document?

冷暖自知 提交于 2019-12-22 05:23:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!