I start with a new R Notebook in RStudio:
---
title: "R Notebook"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. Etc Etc Etc.
Then I modify it to do what I want -- for example, I'm trying to use microbenchmark()
.
---
title: "R Notebook"
output: html_notebook
---
Let's compare the sort methods on a set of shuffled integers.
```{r}
library(microbenchmark)
n <- 100000L
microbenchmark(
sort(sample.int(n),method='radix'),
sort(sample.int(n),method='quick'),
sort(sample.int(n),method='shell')
)
```
Submitting this microbenchmark()
to the console gives sensible output, like:
Unit: milliseconds
expr min lq mean median uq max neval cld
sort(sample.int(n), method = "radix") 4.685707 4.914925 6.559412 5.619257 7.539383 16.66746 100 a
sort(sample.int(n), method = "quick") 8.169732 8.534512 10.490920 9.333782 11.008653 21.44854 100 b
sort(sample.int(n), method = "shell") 10.766820 11.144858 15.479061 12.408976 14.519405 133.87898 100 c
However, when I try to knit
it (click the drop-down from "Preview" to "Knit to HTML", it automatically changes my header to:
---
title: "R Notebook"
output:
html_document:
df_print: paged
---
Which really messes up the output -- now it looks like this:
If I go back and change the header back to output: html_notebook
and click the "Knit" button again, now it looks right:
Is there a way to prevent RStudio from messing up my first knit
?
I'm on RStudio Version 1.1.419 for Windows.