There are a few common problems that people have had with their labs. This page will be updated with new problems when they arise, and it’s a good place to look if you’re having trouble.

Downloading the HTML so you can upload it to moodle

To download the knitted HTML, go to the Files tab (lower right corner, same pane as Plots and Help) and select the checkbox next to your document’s name. Make sure it is the HTML file with the same filename as the Rmd file you were editing. Then click the More button and select Export. This will download the file onto your computer and you can then upload it to moodle. For a short video showing this process, see here.

Document won’t knit

There could be many reasons for this, but the most common are:

mean(~weight, data=cdc) 169.683
> mean(~weight, data=cdc)

or

cdc %>%
+ filter(weight>100)
  cdc

in your document, but also dplyr expressions that aren’t saved into an object can do it, like

  cdc %>%
   filter(weight>100)
require(mosaic)
require(oilabs)

and often you also need

require(dplyr)

Code not being evaluated

If you have code showing up in your document like this

mean(~weight, data=cdc)

where the code isn’t colored nicely and the output isn’t showing, that’s often because your chunk delimiters weren’t specified correctly. You need three “ticks” (the key on the upper left corner of the keyboard, usually, the same one with the ~): ``` Then you need curly braces with an “r” in the middle, {r}, then a line break, then your code, and finally three more ticks.

If you’re having trouble getting the formatting correct, you can always click the Chunks button at the upper right corner of the RMarkdown window and select Insert Chunk. This will do all the formatting for you.

No Knit HTML button

This means that RStudio doesn’t understand your document is supposed to be an RMarkdown document, often because your file extension is .txt. To fix this, go to the Files tab (lower right corner, same pane as Plots and Help) and select the checkbox next to your document’s name. Then select Rename and remove the .txt and make sure the extension is .Rmd.