rm(list=ls())
%>% is Ctrl+Shift+M (Windows) or Cmd+Shift+M (Mac).<- is Alt + - (Windows) or Option + - (Mac).Code > Rename in Scope. This is better than using Edit > Replace and Find because it only looks for whole word matches.This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. A useful guide to help you get started can be found here.
Rmarkdown is a great way to perform reproducible research and generate reports.
File -> New File -> R Markdown...Knit HTML button up the top of the source window. You click that button to turn the markdown into HTML (or PDF or Word).r, the (optional) chunk name and any arugments: ```{r} or ```{r chunk_name, tidy=TRUE}. The chunk also ends with three back ticks ```. Examples can be seen in the template that opens along as a new file in RStudio.You can embed static plots in an rmarkdown document without doing anything special. Important chunk options are fig.width and fig.height to set the figure width and height for example ```{r, fig.width=4, fig.height=6}.
Some useful chunk options:
tidy = TRUE makes the R code more readable (proper spacing)results = 'hide' hide the results of the chunk output (i.e. don’t show them)results = 'hold' hold the results of the chunk output until all commands in the chunk have been runwarning = FALSE don’t show any warning messages (e.g. when ggplot2 drops observations)message = FALSE don’t show any messages (e.g. when packages load){r chunkname} you can name your chunks with text immediately after the r. This can be particularly useful when errors pop up as it makes it easier to identify which chunk the error occurs in.