Some readers have been having a bit of trouble using
devtools to install
WVPlots (announced here and used to produce some of the graphs shown here). I thought I would write a note with a few instructions to help.
These are things you should not have to do often, and things those of us already running
R have stumbled through and forgotten about. These are also the kind of finicky system dependent non-repeatable interactive GUI steps you largely avoid once you have a scriptable system like fully R up and running.
First you will need install (likely admin) privileges on your machine and a network connection that is not blocking and of cran, RStudio or Github.
Once you have these we will try to “knit” or render a R markdown document. To do this start RStudio select
File->"New File"->"R Markdown" as shown below (menus may be different on different systems, you will have to look around a bit).
Then click “OK”. Then press the “Knit HTML” button as shown in the next figure.
This will ask you to pick a filename to save as (anything ending in “.Rmd” will do). If RStudio asks to install anything let it. In the end you should get a rendered copy of RStudio’s example document. If any of this doesn’t work you can look to RStudio documentation.
Assuming the above worked paste the following commands into RStudio’s “Console” window (entering a “return” after the paste to ensure execution).
[Note any time we say paste or type, watch out for any errors caused by conversion of normal machine quotes to insidious smart quotes.]
The set of packages you actually need can usually be found by looking at the
R you wish to run and looking for any
:: commands. R scripts and worksheets tend not to install packages on their own as that would be a bit invasive.
If the above commands execute without error (messages and warnings are okay) you can then try the command below to install
If the above fails (some Windows users are seeing “curl” errors) it can be a problem with your machine (perhaps permissions, or no curl library installed), network, anti-virus, or firewall software. If it does fail you can try to install
WVPlots yourself by doing the following:
- Navigate a web browser to http://winvector.github.io/WVPlots/.
- From there download the file
- In the RStudio "Console" window type:
install.packages(c('ROCR', 'ggplot2', 'gridExtra', 'mgcv', 'plyr', 'reshape2', 'stringr', 'knitr', 'testthat'))(we are installing the dependencies of
WVPlotsby hand, the dependencies are found by looking at the WVPLots DESCRIPTION file, and excluding
gridas it is part of the base system and doesn’t need to be installed).
- In the RStudio “Console” window type:
'~/Downloads/WVPlots_0.1.tar.gz'with wherever you downloaded
If the above worked you can test the
WVPlots package by typing
Now you can try knitting one of our example worksheets.
- Navigate a web browser to https://github.com/WinVector/Examples/blob/master/PCR/XonlyPCA.Rmd
- Download the file
XonlyPCA.Rmdby right-clicking on the “Raw” button (towards the top right).
- Rename the downloaded file from
- In Rstudio use
File->"Open File"to open
- Press the “Knit HTML” button (top middle of the editor pane) and this should produced the rendered result.
If this isn’t working then something is either not installed or configured correctly, or something is blocking access (such as anti-virus software or firewall software). The best thing to do is find another local
R user and debug together.
Data Scientist and trainer at Win Vector LLC. One of the authors of Practical Data Science with R.