Created
March 9, 2015 03:40
-
-
Save njtierney/7134f9899fa1c1263147 to your computer and use it in GitHub Desktop.
This code is my standard setup for rmarkdown in knitr.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r global_options, include=FALSE, cache=FALSE} | |
library(knitr) | |
# Set basic options. You usually do not want your code, messages, warnings etc. | |
# to show in your actual manuscript however for the first run or two these will | |
# be set on. | |
opts_chunk$set(echo=FALSE, | |
warning=FALSE, | |
message=FALSE, | |
cache = TRUE, | |
include = FALSE, | |
results = 'hide', | |
error = TRUE) | |
# setup changes according to html or docx | |
output <- opts_knit$get("rmarkdown.pandoc.to") | |
if (output=="html") { | |
opts_chunk$set(fig.width=11, | |
fig.height=11) | |
} # # end html `if` statement | |
## setting up the figure parameters for docx | |
if (output=="docx") { | |
opts_chunk$set(dev = 'pdf', | |
fig.width = 6, | |
fig.height = 6) | |
} # end docx `if` statement | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment