safarirstudioknitrwebarchive

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?


Solution

  • You can use the below command for this:

    textutil -convert html example.webarchive
    

    But be warned that it creates all the files in the current directory, so if you have a lot of images, they will get placed there.

    Hope this helps!