<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/big-changes-behind-the-scenes-in-r-3-5-0/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/04/r-350.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>A major update to <a rel="nofollow" href="https://www.r-project.org/" target="_blank">R</a> is now available. The R Core group has <a rel="nofollow" href="https://stat.ethz.ch/pipermail/r-announce/2018/000628.html" target="_blank">announced the release of R 3.5.0</a>, and binary versions for Windows and Linux are now available from the primary <a rel="nofollow" href="https://cloud.r-project.org/" target="_blank">CRAN mirror</a>. (The Mac release is forthcoming.)</p>
<p>Probably the biggest change in R 3.5.0 will be invisible to most users — except by the performance improvements it brings. The <a rel="nofollow" href="http://blog.revolutionanalytics.com/2017/09/altrep-preview.html" target="_blank">ALTREP project</a> has now been rolled into R to use more efficient representations of many vectors, resulting in less memory usage and faster computations in many common situations. For example, the sequence vector <code>1:1000000</code> is now represented just by its start and end value, instead of allocating a vector of a million elements as earlier versions of R would do. So while R 3.4.3 takes about 1.5 seconds to run <code>x &lt;- 1:1e9</code> on my laptop, it's instantaneous in R 3.5.0.</p>
<p>There have been improvements in other areas too, thanks to ALTREP. The output of the <code>sort</code> function has a new representation: it includes a flag indicating that the vector is already sorted, so that sorting it again is instantaneous. As a result, running <code>x &lt;- sort(x)</code> is now free the second and subsequent times you run it, unlike earlier versions of R. This may seem like a contrived example, but operations like this happen all the time in the internals of R code. Another good example is converting a numeric to a character vector: <code>as.character(x)</code> is now also instantaneous (the coercion to character is deferred until the character representation is actually needed). This has significant impact in R's statistical modelling functions, which carry around a long character vector that usually contains just numbers — the row names — with the design matrix. As a result, the calculation:</p>
<pre>d &lt;- data.frame(y = rnorm(1e7), x = 1:1e7)
lm(y ~ x, data=d)
</pre>
<p>runs about 4x faster on my system. (It also uses a lot less memory: running the equivalent command with 10x more rows failed for me in R 3.4.3 but succeeded in 3.5.0.)</p>
<p>The ALTREP system is designed to be extensible, but in R 3.5.0 the system is used exclusively for the internal operations of R. Nonetheless, if you'd like to get a sneak peek on how you might be able to use ALTREP yourself in future versions of R, you can take a look at <a rel="nofollow" href="https://svn.r-project.org/R/branches/ALTREP/ALTREP.html" target="_blank">this vignette</a> (with the caveat that the interface may change when it's finally released).</p>
<p>There are many other improvements in R 3.5.0 beyond the ALTREP system, too. You can find the full details in the <a rel="nofollow" href="https://stat.ethz.ch/pipermail/r-announce/2018/000628.html" target="_blank">announcement</a>, but here are a few highlights:</p>
<ul>
<li>All packages are now byte-compiled on installation. R's base and recommended packages, and packages on CRAN, were already byte-compiled, so this will have the effect of improving the performance of packages installed from Github and from private sources.</li>
<li>R's performance is better when many packages are loaded, and more packages can be loaded at the same time on Windows (when packages use compiled code).</li>
<li>Improved support for <a rel="nofollow" href="http://blog.revolutionanalytics.com/2012/07/big-vectors-coming-to-r.html" target="_blank">long vectors</a>, by functions including <code>object.size</code>, <code>approx</code> and <code>spline</code>. </li>
<li>Reading in text data with <code>readLines</code> and <code>scan</code> should be faster, thanks to buffering on text connections.</li>
<li>R should handle some international data files better, with several bugs related to character encodings having been resolved.</li>
</ul>
<p>Because R 3.5.0 is a major release, you will need to re-install any R packages you use. (The <a rel="nofollow" href="https://www.r-statistics.com/2018/04/r-3-5-0-is-released-major-release-with-many-new-features/" target="_blank">installr package</a> can help with this.) On my reading of the release notes, there haven't been any major backwardly-incompatible changes, so your old scripts <em>should</em> continue to work. Nonetheless, given the significant changes behind the scenes, it might be best to wait for a maintenance release before using R 3.5.0 for production applications. But for developers and data science work, I recommend jumping over to R 3.5.0 right away, as the benefits are significant. </p>
<p>You can find the details of what's new in R 3.5.0 at the link below. As always, many thanks go to the <a rel="nofollow" href="https://www.r-project.org/contributors.html" target="_blank">R Core team</a> and the other volunteers who have contributed to the open source R project over the years.</p>
<p>R-announce mailing list: <a rel="nofollow" href="https://stat.ethz.ch/pipermail/r-announce/2018/000628.html" target="_blank">R 3.5.0 is released</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/04/r-350.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/niZVIXOXKvA" height="1"></a></div>