<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/r-3-5-0-is-released-major-release-with-many-new-features/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.r-statistics.com/2018/04/r-3-5-0-is-released-major-release-with-many-new-features/"> R – R-statistics blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>R 3.5.0 (codename “Joy in Playing”) was <a rel="nofollow" href="https://stat.ethz.ch/pipermail/r-announce/2018/000628.html" target="_blank">released yesterday</a>. You can get the latest binaries version <strong><a rel="nofollow" href="https://cran.rstudio.com/" target="_blank">from here</a>.</strong> (or the .tar.gz <strong>source</strong> code from <a rel="nofollow" href="https://cran.r-project.org/src/base/R-3/R-3.5.0.tar.gz" target="_blank">here</a>).</p>
<p>This is a major release with many new features and bug fixes, the full list is provided below.</p>
<h3>Upgrading R on Windows and Mac</h3>
<p>If you are using <strong>Windows </strong>you can easily upgrade to the latest version of R using <a rel="nofollow" href="https://cran.r-project.org/web/packages/installr/" target="_blank">the installr package</a>. Simply run the following code in Rgui:</p>
<div>
<table>
<tr>
<td>
<pre><span>install.<span>packages</span></span><span>(</span><span>&quot;installr&quot;</span><span>)</span> <span># install </span>
setInternet2<span>(</span>TRUE<span>)</span> <span># only for R versions older than 3.3.0</span>
installr<span>::</span><span>updateR</span><span>(</span><span>)</span> <span># updating R.</span>
<span># If you wish it to go faster, run: installr::updateR(T)</span></pre>
</td>
</tr>
</table>
</div>
<p>Running “updateR()” will detect if there is a new R version available, and if so it will download+install it (etc.). There is also <a rel="nofollow" href="https://www.r-statistics.com/2015/06/a-step-by-step-screenshots-tutorial-for-upgrading-r-on-windows/" target="_blank">a step by step tutorial (with screenshots) on how to upgrade R on Windows, using the <em>installr</em></a> package. If you only see the option to upgrade to an older version of R, then change your mirror or try again in a few hours (it usually take around 24 hours for all CRAN mirrors to get the latest version of R).</p>
<p>If you are using <strong>Mac </strong>you can easily upgrade to the latest version of R using Andrea Cirillo’s <a rel="nofollow" href="https://github.com/AndreaCirilloAC/updateR" target="_blank">updateR package</a>. The package is not on CRAN, so you’ll need to run the following code in Rgui:</p>
<div>
<table>
<tr>
<td>
<pre><span>install.<span>packages</span></span><span>(</span><span>&quot;devtools&quot;</span><span>)</span>
devtools<span>::</span><span>install_github</span><span>(</span><span>&quot;AndreaCirilloAC/updateR&quot;</span><span>)</span>
updateR<span>(</span>admin_password <span>=</span> <span>&quot;PASSWORD&quot;</span><span>)</span> <span># Where &quot;PASSWORD&quot; stands for your system password</span></pre>
</td>
</tr>
</table>
</div>
<p>Later this year Andrea and I intend to merge the updateR package into installr so that the updateR function will work seamlessly in both Windows and Mac. Stay tuned <img alt="🙂" src="https://i1.wp.com/s.w.org/images/core/emoji/2.4/72x72/1f642.png?w=456&ssl=1" class="wp-smiley" data-recalc-dims="1"></p>
<p><span></span></p>
<h3>CHANGES IN R 3.5.0</h3>
<h4>SIGNIFICANT USER-VISIBLE CHANGES</h4>
<ul>
<li>All packages are by default byte-compiled on installation. This makes the installed packages larger (usually marginally so) and may affect the format of messages and tracebacks (which often exclude <code>.Call</code> and similar).</li>
</ul>
<h4>NEW FEATURES</h4>
<ul>
<li><code>factor()</code> now uses <code>order()</code> to sort its levels, rather than <code>sort.list()</code>. This allows <code>factor()</code> to support custom vector-like objects if methods for the appropriate generics are defined. It has the side effect of making <code>factor()</code> succeed on empty or length-one non-atomic vector(-like) types (e.g., <code>&quot;list&quot;</code>), where it failed before.</li>
<li><code>diag()</code> gets an optional <code>names</code> argument: this may require updates to packages defining S4 methods for it.</li>
<li><code>chooseCRANmirror()</code> and <code>chooseBioCmirror()</code> no longer have a <code>useHTTPS</code> argument, not needed now all <b>R</b> builds support <span>https://</span> downloads.</li>
<li>New <code>summary()</code> method for <code>warnings()</code> with a (somewhat experimental) <code>print()</code> method.</li>
<li>(<span>methods</span> package.) <code>.self</code> is now automatically registered as a global variable when registering a reference class method.</li>
<li><code>tempdir(check = TRUE)</code> recreates the <code>tempdir()</code> directory if it is no longer valid (e.g. because some other process has cleaned up the ‘<span>/tmp</span>’ directory).</li>
<li>New <code>askYesNo()</code> function and <code>&quot;askYesNo&quot;</code> option to ask the user binary response questions in a customizable but consistent way. (Suggestion of <a rel="nofollow" href="https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17242" target="_blank">PR#17242</a>.)</li>
<li>New low level utilities <code>...elt(n)</code> and <code>...length()</code> for working with <code>...</code> parts inside a function.</li>
<li><code>isTRUE()</code> is more tolerant and now true in
<pre>   x &lt;- rlnorm(99)
   isTRUE(median(x) == quantile(x)[&quot;50%&quot;])</pre>
<p>New function <code>isFALSE()</code> defined analogously to <code>isTRUE()</code>.
<li>The default symbol table size has been increased from 4119 to 49157; this may improve the performance of symbol resolution when many packages are loaded. (Suggested by Jim Hester.)</li>
<li><code>line()</code> gets a new option <code>iter = 1</code>.</li>
<li>Reading from connections in text mode is buffered, significantly improving the performance of <code>readLines()</code>, as well as <code>scan()</code> and <code>read.table()</code>, at least when specifying <code>colClasses</code>.</li>
<li><code>order()</code> is smarter about picking a default sort <code>method</code> when its arguments are objects.</li>
<li><code>available.packages()</code> has two new arguments which control if the values from the per-session repository cache are used (default true, as before) and if so how old cached values can be to be used (default one hour).These arguments can be passed from <code>install.packages()</code>, <code>update.packages()</code> and functions calling that: to enable this <code>available.packages()</code>, <code>packageStatus()</code> and<code>download.file()</code> gain a <code>...</code> argument.</li>
<li><code>packageStatus()</code>‘s <code>upgrade()</code> method no longer ignores its <code>...</code> argument but passes it to <code>install.packages()</code>.</li>
<li><code>installed.packages()</code> gains a <code>...</code> argument to allow arguments (including <code>noCache</code>) to be passed from <code>new.packages()</code>, <code>old.packages()</code>, <code>update.packages()</code> and <code>packageStatus()</code>.</li>
<li><code>factor(x, levels, labels)</code> now allows duplicated <code>labels</code> (not duplicated <code>levels</code>!). Hence you can map different values of <code>x</code> to the same level directly.</li>
<li>Attempting to use <code>names&lt;-()</code> on an S4 derivative of a basic type no longer emits a warning.</li>
<li>The <code>list</code> method of <code>within()</code> gains an option <code>keepAttrs = FALSE</code> for some speed-up.</li>
<li><code>system()</code> and <code>system2()</code> now allow the specification of a maximum elapsed time (‘timeout’).</li>
<li><code>debug()</code> supports debugging of methods on any object of S4 class <code>&quot;genericFunction&quot;</code>, including group generics.</li>
<li>Attempting to increase the length of a variable containing <code>NULL</code> using <code>length()&lt;-</code> still has no effect on the target variable, but now triggers a warning.</li>
<li><code>type.convert()</code> becomes a generic function, with additional methods that operate recursively over list and <code>data.frame</code> objects. Courtesy of Arni Magnusson (<a rel="nofollow" href="https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17269" target="_blank">PR#17269</a>).</li>
<li><code>lower.tri(x)</code> and <code>upper.tri(x)</code> only needing <code>dim(x)</code> now work via new functions <code>.row()</code> and <code>.col()</code>, so no longer call <code>as.matrix()</code> by default in order to work efficiently for all kind of matrix-like objects.</li>
<li><code>print()</code> methods for <code>&quot;xgettext&quot;</code> and <code>&quot;xngettext&quot;</code> now use <code>encodeString()</code> which keeps, e.g. <code>&quot;\n&quot;</code>, visible. (Wish of <a rel="nofollow" href="https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17298" target="_blank">PR#17298</a>.)</li>
<li><code>package.skeleton()</code> gains an optional <code>encoding</code> argument.</li>
<li><code>approx()</code>, <code>spline()</code>, <code>splinefun()</code> and <code>approxfun()</code> also work for long vectors.</li>
<li><code>deparse()</code> and <code>dump()</code> are more useful for S4 objects, <code>dput()</code> now using the same internal C code instead of its previous imperfect workaround R code. S4 objects now typically deparse perfectly, i.e., can be recreated identically from deparsed code.<code>dput()</code>, <code>deparse()</code> and <code>dump()</code> now print the <code>names()</code> information only once, using the more readable <code>(tag = value)</code> syntax, notably for <code>list()</code>s, i.e., including data frames.
<p>These functions gain a new control option <code>&quot;niceNames&quot;</code> (see <code>.deparseOpts()</code>), which when set (as by default) also uses the <code>(tag = value)</code> syntax for atomic vectors. On the other hand, without deparse options <code>&quot;showAttributes&quot;</code> and <code>&quot;niceNames&quot;</code>, names are no longer shown also for lists. <code>as.character(list( c (one = 1)))</code> now includes the name, as <code>as.character(list(list(one = 1)))</code> has always done.</p>
<p><code>m:n</code> now also deparses nicely when <i>m > n</i>.</p>
<p>The <code>&quot;quoteExpressions&quot;</code> option, also part of <code>&quot;all&quot;</code>, no longer <code>quote()</code>s formulas as that may not re-parse identically. (<a rel="nofollow" href="https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17378" target="_blank">PR#17378</a>)
<li>If the option <code>setWidthOnResize</code> is set and <code>TRUE</code>, <b>R</b> run in a terminal using a recent <code>readline</code> library will set the <code>width</code> option when the terminal is resized. Suggested by Ralf Goertz.</li>
<li>If multiple <code>on.exit()</code> expressions are set using <code>add = TRUE</code> then all expressions will now be run even if one signals an error.</li>
<li><code>mclapply()</code> gets an option <code>affinity.list</code> which allows more efficient execution with heterogeneous processors, thanks to Helena Kotthaus.</li>
<li>The <code>character</code> methods for <code>as.Date()</code> and <code>as.POSIXlt()</code> are more flexible <em>via</em> new arguments <code>tryFormats</code> and <code>optional</code>: see their help pages.</li>
<li><code>on.exit()</code> gains an optional argument <code>after</code> with default <code>TRUE</code>. Using <code>after = FALSE</code> with <code>add = TRUE</code> adds an exit expression before any existing ones. This way the expressions are run in a first-in last-out fashion. (From Lionel Henry.)</li>
<li>On Windows, <code>file.rename()</code> internally retries the operation in case of error to attempt to recover from possible anti-virus interference.</li>
<li>Command line completion on <span>::</span> now also includes lazy-loaded data.</li>
<li>If the <span>TZ</span> environment variable is set when date-time functions are first used, it is recorded as the session default and so will be used rather than the default deduced from the OS if <span>TZ</span> is subsequently unset.</li>
<li>There is now a <code>[</code> method for class <code>&quot;DLLInfoList&quot;</code>.</li>
<li><code>glm()</code> and <code>glm.fit</code> get the same <code>singular.ok = TRUE</code> argument that <code>lm()</code> has had forever. As a consequence, in <code>glm(*, method = </code></ul>