Reputation: 3992
In RStudio, the Compile notebook feature is very handy, but I'd like to be able to change the default figure width and height globally for a given .R script. How can this be done?
Upvotes: 2
Views: 1007
Reputation: 30124
According to RStudio documentation, there are two possible notebook types at the moment. To achieve what you want, you have to choose the type knitr::spin
, which allows you to change chunk options; see knitr documentation for details.
In this case, you just add a code chunk to set up chunk options, e.g.,
#+ setup, include=FALSE
library(knitr)
opts_chunk$set(fig.width = 5, fig.height = 10)
#' write the rest of your code
1 + 1
rnorm(10)
plot(cars)
Upvotes: 4