Site icon R-bloggers

Quick tip: knitr Python Windows setup checklist

[This article was first published on R – Locke Data, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

The post Quick tip: knitr Python Windows setup checklist appeared first on Locke Data.

To leave a comment for the author, please follow the link and comment on their blog: R – Locke Data.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.