How to knit into HTML files from RStudio on a Mac?

I teach a data science class where I have the students type notes and homework in R markdown. From there, RStudio usually knits documents into an HTML file. I prefer to have the students turn in those easy-to-read HTML files for grading. However, some of my students are using Safari and a Mac book. Their software knits into more advanced .webarchive files by default. How can we get .html files?

It also produces .html files - it sounds like maybe the students are opening in a browser, then saving, rather than just emailing you the .html file that rmarkdown produces.

1 Like

Having talked to a few students and reading the information in the How to tell RStudio to use GoogleChrome and not IE 10? thread, it does appear that my students who use Chrome/Firefox/IE are getting the HTML files, but those using Safari are not. I will tell my students that---for their R markdown homework---they should set a default browser to something other than Safari.

I agree with Hadley's original assessment, in that case. It sounds like your students are using the following workflow:

  1. Clicking the "Knit" button
  2. Then clicking on the "Open in Browser" button when the preview comes up
  3. Finally, saving the web page using their browser

In reality, the HTML file was already made in step #1, so it's not necessary to "Save" the knitted file after that. Are they using RStudio desktop or server? In the case of the latter, it may be that they aren't realizing that they can download the HTML file from the server. If it's the desktop version, they just might not know that there is now an HTML file in the directory with their Rmd file.