<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/"></div></div><div><a data-url="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/" data-counturl="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/" data-count="horizontal" data-text="Installing WVPlots and “knitting R markdown”" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.win-vector.com/blog/2016/05/installing-wvplots-and-knitting-r-markdown/"> R – Win-Vector Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Some readers have been having a bit of trouble using <a target="_blank" href="https://cran.r-project.org/package=devtools"><code>devtools</code></a> to install <a target="_blank" href="https://github.com/WinVector/WVPlots"><code>WVPlots</code></a>. 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 <code>R</code> have stumbled through and forgotten about.<span></span></p>
<p>
<p>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.</p>
<p>Make sure you have up to date copies of both <a target="_blank" href="https://cran.r-project.org/">R</a> and <a target="_blank" href="https://www.rstudio.com/">RStudio</a>. We have to assume you are somewhat familiar with R and RStudio (so suggest a tutorial if you are not).</p>
<p>Once you have these we will try to “knit” or render a R markdown document. To do this start RStudio select <code>File->&quot;New File&quot;->&quot;R Markdown&quot;</code> as shown below (menus may be different on different systems, you will have to look around a bit).</p>
<p><img title="RStudio1.png" alt="RStudio1" src="http://i0.wp.com/www.win-vector.com/blog/wp-content/uploads/2016/05/RStudio1.png?resize=393%2C290" border="0" data-recalc-dims="1"></p>
<p>Then click “OK”. Then press the “Knit HTML” button as shown in the next figure.</p>
<p><img title="RStudio2.png" alt="RStudio2" src="http://i0.wp.com/www.win-vector.com/blog/wp-content/uploads/2016/05/RStudio2.png?resize=396%2C96" border="0" data-recalc-dims="1"></p>
<p>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 <a target="_blank" href="http://rmarkdown.rstudio.com/">RStudio documentation</a>.</p>
<p>Assuming the above worked paste the following commands into RStudio’s “Console” window (entering a “return” after the paste to ensure execution).<br>
[Note any time we say paste or type, watch out for any errors caused by conversion of normal machine quotes to insidious smart quotes.]</p>
<p><code>
<pre>
install.packages(c('RCurl','ggplot2','tidyr',
                    'devtools','knitr'))
</pre>
<p></p>
<p>The set of packages you actually need can usually be found by looking at the <code>R</code> you wish to run and looking for any <code>library()</code> or <code>::</code> commands. R scripts and worksheets tend not to install packages on their own as that would be a bit invasive.</p>
<p>If the above commands execute without error (messages and warnings are okay) you can then try the command below to install <code>WVPlots</code>:</p>
<p><code>
<pre>
devtools::install_github('WinVector/WVPlots',
                        build_vignettes=TRUE)
</pre>
<p></p>
<p>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 <code>WVPlots</code> yourself by doing the following:</p>
<ol>
<li>Navigate a web browser to <a target="_blank" href="http://winvector.github.io/WVPlots/">http://winvector.github.io/WVPlots/</a>.</li>
<li>From there download the file <code>WVPlots_0.1.tar.gz</code>.</li>
<li>In the RStudio “Consoel” window type: <code>install.packages('~/Downloads/WVPlots_0.1.tar.gz',repos=NULL)</code> (replacing <code>'~/Downloads/WVPlots_0.1.tar.gz'</code> with wherever you downloaded <code>WVPlots_0.1.tar.gz</code> to).</li>
</ol>
<p>If the above worked you can test the <code>WVPlots</code> package by typing <code>library(&quot;WVPlots&quot;)</code>.</p>
<p>Now you can try knitting one of our example worksheets.</p>
<ol>
<li>Navigate a web browser to <a target="_blank" href="https://github.com/WinVector/Examples/blob/master/PCR/XonlyPCA.Rmd">https://github.com/WinVector/Examples/blob/master/PCR/XonlyPCA.Rmd</a></li>
<li>Download the file <code>XonlyPCA.Rmd</code> by right-clicking on the “Raw” button (towards the top right).</li>
<li>Rename the downloaded file from <code>XonlyPCA.Rmd.txt</code> to <code>XonlyPCA.Rmd</code>.</li>
<li>In Rstudio use <code>File->&quot;Open File&quot;</code> to open <code>XonlyPCA.Rmd</code>.</li>
<li>Press the “Knit HTML” button (top midle of the editor pane) and this should produced the rendered result.</li>
</ol>
<p>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 <code>R</code> user and debug together.</p>

<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/"></div></div><div><a data-url="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/" data-counturl="http://www.r-bloggers.com/installing-wvplots-and-knitting-r-markdown/" data-count="vertical" data-text="Installing WVPlots and “knitting R markdown”" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>

<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.win-vector.com/blog/2016/05/installing-wvplots-and-knitting-r-markdown/"> R – Win-Vector Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/rX3uDpUiF9I"></a></div></code></code>