Introduction to the RMarkdown exercise interface
Welcome to the RMarkdown exercise interface. It is a little bit different from the one you have seen so far: When you click "Knit HTML", the interface will knit your R Markdown document into an HTML file and display that in a new pane. You could also knit it to a PDF file, but you are going to stick to HTML in this course.
For your convenience, we've included some basic R code that quickly produces a plot from the graphics
R package, which is loaded by default, using a data set mtcars
, which is also loaded by default.
This exercise is part of the course
Communicating with Data in the Tidyverse
Exercise instructions
- Adjust the title to
"Communicating with Data in the Tidyverse"
, the author to your name, and the date in the YAML header at the very top of the RMarkdown file. - Click the "Knit HTML" button in order to see the knitted HTML file, opening up in a new pane.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
{"my_document.Rmd":"---\ntitle: \"___\"\nauthor: \"___\"\ndate: \"___\"\noutput: html_document\n---\n\nThe following plot shows the relationship between the number of cylinders and miles per gallon in the `mtcars` dataset.\n\n```{r}\nboxplot(mtcars$mpg ~ mtcars$cyl)\n```\n\nAs one can see, the more cylinders, the less miles per gallons.\n\n\n"}