Site icon R-bloggers

Use R and Pelican on Windows

[This article was first published on Pachá (Batteries Included), 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.

Motivation

On a previous post I explained how to install R and Python effortlessy.

Now I bought a Windows machine and this post gathers a lot of reading and experiments I made until I could set everything correctly to write this blog post. I use Pelican for my blog, so I had to do a few steps I wasn’t aware of in Windows.

What do you need to do this?

You’ll need Chocolatey installed and administrator access to Windows PowerShell. In this way an important part of path-related issues are solved.

Install R, Python and LaTeX

This part is easy. From PowerShell run:

choco install r.project python2 miktex

miktex is not needed for Pelican but I use a lot of Rmarkdown and LaTeX for my lectures.

Install Rtools

If you build packages or use packages such as devtools you need the Rtools for Windows. You can download the graphic installer from CRAN.

Install RStudio and GitHub Desktop

I just downloaded the graphic installers and this part this not need additional configurations.

Install Pelican, Markdown and rpy2

MathJax plugin presents problems with newer Pelican versions, so I’ll use Pelican 3.6.3 as in my post for OS X.

Run this from PowerShell:

pip install pelican==3.6.3 markdown

Before installing rpy2 you need to edit the system PATH. Go to the Control Panel and add this to the Path:

C:\Program Files\R\R-3.4.1\bin\x64

Then create the following variables:

R_HOME pointing to C:\Program Files\R\R-3.4.1
R_LIBS_USER pointing to C:\Users\pacha\Documents\R\win-library\3.4
R_USER with your user name

pip install rpy2 did not work in my case. After googling more than 10 minutes I found that the easiest option is to install it using UC Irvine‘s I got the version for Python 2.7 and then I did run:

pip install C:\Users\pacha\Downloads\rpy2-2.7.8-cp27-none-win_amd64.whl

Install R packages

If all of the above steps went well, you can open RStudio and run this:

install.packages(c("tidyverse","data.table","dtplyr","knitr","devtools"))

And finally I was able to write blog entries without errors or warning on Windows!

To leave a comment for the author, please follow the link and comment on their blog: Pachá (Batteries Included).

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.