<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/how-r-gets-built-on-windows/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/10/how-r-gets-built-on-windows.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>I wasn't at the <a rel="nofollow" href="https://www.aanmelder.nl/uros2018" target="_blank">Use of R in Official Statistics</a> (uRos2018) conference in the Netherlands last month, but I'm thankful to <a rel="nofollow" href="https://twitter.com/opencpu/status/1040515443134484481" target="_blank">Jeroen Ooms</a> for sharing the <a rel="nofollow" href="https://jeroen.github.io/uros2018/#1" target="_blank">slides from his keynote presentation</a>. In addition to being a postdoc staffer at <a rel="nofollow" href="https://ropensci.org/about/" target="_blank">ROpenSci</a>, Jeroen maintains the official repository for the <a rel="nofollow" href="https://github.com/rwinlib/base" target="_blank">daily R builds on Windows</a> — you might recognize his name from the verification certificate that pops up when installing R on Windows. His uRos2018 talk provides a fascinating glimpse into the complex systems, dependencies, and processes that come together to make installing R as easy as as double-click.</p>
<p>On thing I found if interest is that while R is a complex program in its own right — made up of a <a rel="nofollow" href="https://github.com/wch/r-source" target="_blank">mix</a> of C (32%), Fortran (24%) and R (37%)  code — it also relies on a number of external libraries to perform some of its underlying tasks. For example:</p>
<ul>
<li>When you multiply two matrices or perform other linear algebra operations, R uses the <a rel="nofollow" href="http://netlib.org/blas/" target="_blank">BLAS</a> and <a rel="nofollow" href="http://www.netlib.org/lapack/" target="_blank">LAPACK</a> libraries for the calculation. (<a rel="nofollow" href="https://mran.microsoft.com/documents/rro/multithread" target="_blank">Microsoft R open</a> swaps in the <a rel="nofollow" href="https://software.intel.com/mkl" target="_blank">Intel Math Kernel Library</a> here, which provides the same calculations using different algorithms.)</li>
<li>When you download a file with <code>download.file</code> or <code>install.packages</code>, R uses the <a rel="nofollow" href="https://curl.haxx.se/libcurl/" target="_blank">libcurl</a> library to manage the network transfer.</li>
<li>When you use character data with foreign encodings (for example text with accents, symbols, and emojis), R uses the <a rel="nofollow" href="http://site.icu-project.org/download" target="_blank">libicu</a> library so those strings can be handled and compared in a uniform way.</li>
<li>When you use regular expressions with <code>grep</code> and <code>regexpr</code>, R uses the <a rel="nofollow" href="http://pcre.org/" target="_blank">PCRE library</a> to parse the syntax and perform the search operation.</li>
<li>For graphics, R uses the <a rel="nofollow" href="https://www.cairographics.org/" target="_blank">cairo library</a> to render points, lines, and text as a bitmap image for display and/or export.</li>
</ul>
<p>Using these libraries means that the R maintainers don't need to reimplement the wheel, but can instead use open-source libraries that are used in a plethora of systems to accomplish these universal tasks. On Linux-based systems, these libraries are generally pre-installed for any application to use. But on Windows (and Mac), R needs to build these libraries for its own use, which makes building R a complex process. Not only do you have to have the right set of compilers and scripts to build R itself, but also all its library dependencies as well. R packages may, in turn, depend on other third-party libraries and in that case the same issues apply to building them, too.</p>
<p><a rel="nofollow" href="https://jeroen.github.io/uros2018/#10" target="_blank"><img border="0" alt="R dependencies" title="R dependencies" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b022ad3b7e025200b-800wi"></a></p>
<p>You can find all of the <a rel="nofollow" href="https://github.com/rwinlib/base" target="_blank">scripts used to create</a> the official releases and daily builds (r-patched and r-devel) for R for Windows on Github. Brian Ripley and Duncan Murdoch (and now, Jeroen Ooms) have long provided <a rel="nofollow" href="https://cran.r-project.org/bin/windows/Rtools/" target="_blank">RTools</a>: a <a rel="nofollow" href="https://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset" target="_blank">collection</a> of Windows programs (shell commands, other programs) which, given the right compiler, will allow R's build scripts to run. One other interesting bit of news from Jeroen's keynote is that an <a rel="nofollow" href="https://cloud.r-project.org/bin/windows/testing/rtools40.html" target="_blank">experimental version of RTools</a> is on the way, which promises to make it easier to build, distribute and install external libraries on Windows.</p>
<p>If you're at all interested in the inner workings of what it takes to make R run on Windows, I recommend checking out Jeroen's talk at the link below.</p>
<p>Jeroen Ooms: <a rel="nofollow" href="https://jeroen.github.io/uros2018/#1" target="_blank">The R infrastructure</a></p>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2018/10/how-r-gets-built-on-windows.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/7KDNX0VImQM" height="1"></a></div>