Quick tip: knitr Python Windows setup checklist

February 22, 2017

(This article was first published on R – Locke Data, and kindly contributed to R-bloggers)

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

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)