One of the nifty things about using R is that you can use it for many different purposes and even other languages!

If you want to use Python in your knitr docs or the newish RStudio R notebook functionality, you might encounter some fiddliness getting all the moving parts running on Windows. This is a quick knitr Python Windows setup checklist to make sure you don’t miss any important steps.

  1. Install Python
    • I like Anaconda as it’s one of the nicest Windows install experiences
    • Try to install for everyone
  2. Add python to your system’s PATH
  3. Restart RStudio or open it now
    • The restart is because the PATH would likely have been cached so restarting adds the python executable to your RStudio environment
  4. Create an rmarkdown document or R Notebook
  5. Use chunks beginning with {python chunkname} to execute some code in Python instead of the usual {r chunkname}
Environment variable editor for PATH in Windows 10
Environment variable editor for PATH in Windows 10
Quick tip: knitr Python Windows setup checklist
Tagged on:             

What do you think?