How to set graphical parameters (par ()) and structure parameters (strOptions ()) in a knitr document?

I am working on a knitr-sweave document and found that global parameters R such as

par(lwd=3) 

and

 strOptions(strict.width='cut') 

do not take effect in later code snippets. I can specify these parameters as arguments every time I draw () or str (), so this is not a huge problem. I'm just wondering if anyone has an idea about this. Should I cache a piece of code where I set these parameters? I call some libraries in the earlier code snippets and set the variables in others, and they all seem to be accessible “globally” (i.e. in the later code snippets).

+6
source share
1 answer

I believe I can help you set strOptions globally. Just set str parameters as a list under options , for example:

 options(str = list(strict.width = "cut")) 
+1
source

All Articles