R 3.1.0 (codename “Spring Dance“) was released today!
You can get the source code from
or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course.
The full list of new features and bug fixes is provided below.
Upgrading to R 3.1.0
You can download the latest version from here.
If you are using Windows, it might take another 24 hours until you could update R. For convenience, you can upgrade to the latest version of R using the installr package. Simply run the following code:
# installing/loading the latest installr package: install.packages("installr"); require(installr) #load / install+load installr updateR()
After running “updateR()”, the function will detect that R is available for you, and will download+install it (etc.).
Note that the latest installr version (0.14.0) was released a week ago to CRAN, and it is recommended to upgrade to it, since it is now more robust for various extreme cases of upgrading R.
I try to keep the installr package updated and useful, so if you have any suggestions or remarks on the package – you are invited to leave a comment below.
If you use the global library system (as I do), you can run the following in the new version of R:
CHANGES IN R 3.1.0:
type.convert()(and hence by default
read.table()) returns a character vector or factor when representing a numeric input as a double would lose accuracy. Similarly for complex inputs.If a file contains numeric data with unrepresentable numbers of decimal places that are intended to be read as numeric, specify
tools::Rdiff(useDiff = FALSE)is closer to the POSIX definition of
diff -b(as distinct from the description in the
manpages of most systems).
- New function
anyNA(), a version of
any(is.na(.))which is fast for atomic vectors, based on a proposal by Tim Hesterberg. (Wish of PR#15239.)
arrayInd(*, useNames = TRUE)and, analogously,
which(*, arr.ind = TRUE)now make use of
is.unsorted()now also works for
as.data.frame()(also useful as
as.data.frame.table()) now passes
uniroot()gets new optional arguments, notably
extendInt, allowing to auto-extend the search interval when needed. The return value has an extra component,
switch(f, ...)now warns when
fis a factor, as this typically happens accidentally where the useR meant to pass a character string, but
fis treated as integer (as always documented).
- The parser has been modified to use less memory.
- The way the unary operators (
+ - !) handle attributes is now more consistent. If there is no coercion, all attributes (including class) are copied from the input to the result: otherwise only names, dims and dimnames are.
colorRampPalette()now allow non-opaque colours and a ramp in opacity via the new argument
alpha = TRUE. (Suggested by Alberto Krone-Martins, but optionally as there are existing uses which expect only RGB values.)
grid.show.viewport()get an optional
- There is a new function
find_gs_cmd()in the tools package to locate a GhostScript executable. (This is an enhanced version of a previously internal function there.)
- There is a new family,
"ArialMT", for the
postscript()devices. This will only be rendered correctly on viewers which have access to Monotype TrueType fonts (which are sometimes requested by journals).
- The text and PDF news files, including ‘NEWS’ and ‘NEWS.2’, have been moved to the ‘doc’ directory.
combn(x, simplify = TRUE)now gives a factor result for factor input
x(previously user error). (Related to PR#15442.)
utils::changedFiles()functions to allow snapshots and comparison of directories of files.
make.names(names, unique=TRUE)now tries to preserve existing names. (Suggestion of PR#15452.)
- New functions
tanpi(x), for more accurate computation of
cos(pi*x), etc, both in R and the C API. Using these gains accuracy in some cases, e.g., inside
besselI(). (Suggested by Morten Welinder in PR#15529.)
print.table(x, zero.print = ".")now also has an effect when
xis not integer-valued.
- There is more support to explore the system’s idea of time-zone names.
Sys.timezone()tries to give the current system setting by name (and succeeds at least on Linux, OS X, Solaris and Windows), and
OlsonNames()lists the names in the system’s Olson database.
Sys.timezone(location = FALSE)gives the previous behaviour.
- Platforms with a 64-bit
time_ttype are allowed to handle conversions between the
"POSIXlt"classes for date-times outside the 32-bit range (before 1902 or after 2037): the existing workarounds are used on other platforms. (Note that time-zone information for post-2037 is speculative at best, and the OS services are tested for known errors and so not used on OS X.)Currently
longand hence 64-bit on Unix-alike 64-bit platforms: however it several cases the time-zone database is 32-bit. On R for Windows it is 64-bit (for both architectures as from this version).
"save.defaults"option can include a value for
compression_level. (Wish of PR#15579.)
colSums()and friends now have support for arrays and data-frame columns with 2^31 or more elements.
as.factor()is faster when
fis an unclassed integer vector (for example, when called from
fft()now works with longer inputs, from the 12 million previously supported up to 2 billion. (PR#15593)
svd()now uses LAPACK subroutine
ZGESDD, the complex analogue of the routine used for the real case.
- Sweave now outputs ‘.tex’ files in UTF-8 if the input encoding is declared to be UTF-8, regardless of the local encoding. The UTF-8 encoding may now be declared using a LaTeX comment containing the string
%\SweaveUTF8on a line by itself.
- Printing of date-times will make use of the time-zone abbreviation in use at the time, if known. For example, for Paris pre-1940 this could be LMT, PMT, WET orWEST. To enable this, the
"POSIXlt"class has an optional component
"zone"recording the abbreviation for each element.For platforms which support it, there is also a component
"gmtoff"recording the offset from GMT where known.
- (On Windows, by default on OS X and optionally elsewhere.) The system C function
strftimehas been replaced by a more comprehensive version with closer conformance to the POSIX 2008 standard.
dnorm(x, log = FALSE)is more accurate (but somewhat slower) for |x| > 5; as suggested in PR#15620.
- Some versions of the
tiff()device have further compression options.
scan()have a new argument to influence the treatment of embedded nuls.
- Avoid duplicating the right hand side values in complex assignments when possible. This reduces copying of replacement values in expressions such as
Z$a <- a0and
ans[[i]] <- tmp: some package code has relied on there being copies.Also, a number of other changes to reduce copying of objects; all contributed by or based on suggestions by Michael Lawrence.
KalmanForecast()has been replaced by
update, which instead of updating
modin place, optionally returns the updated model in an attribute
"mod"of the return value.
makeARIMA()get a new optional argument
SSinit, allowing the choice of a different state space initialization which has been observed to be more reliable close to non-stationarity: see PR#14682.
warning()has a new argument
noBreaks., to simplify post-processing of output with
options(warn = 1).
pushBack()gains an argument
encoding, to support reading of UTF-8 characters using
read.table()and related functions in a non-UTF-8 locale.
all.equal.list()gets a new argument
use.nameswhich by default labels differing components by names (if they match) rather than by integer index. Saved Routput in packages may need to be updated.
- The methods for
attr.all.equal()now have argument
...so it cannot be partially nor positionally matched (as it has been, unintentionally).A side effect is that some previously undetected errors of passing empty arguments (no object between commas) to
all.equal()are detected and reported.
There are explicit checks that
toleranceis numeric and
NULLor numeric. This catches some unintended positional matching.
The message for
"scaled difference"only for
scale != 1.
all.equal()now has a
"POSIXt"method replacing the
by = "quarter"for completeness (
by = "3 months"always worked).
file.path()removes any trailing separator on Windows, where they are invalid (although sometimes accepted). This is intended to enhance the portability of code written by those using POSIX file systems (where a trailing
/can be used to confine path matching to directories).
- New function
grepl()returns a logical vector.
fifo()is now supported on Windows. (PR#15600)
sort.list(method = "radix")now allows negative integers (wish of PR#15644).
- Some functionality of
print.ts()is now available in
.preformat.ts()for more modularity.
mcparallel()gains an option
detach = TRUEwhich allows execution of code independently of the current session. It is based on a new
estranged = TRUEargument to
mcfork()which forks child processes such that they become independent of the parent process.
pdf()device omits circles and text at extremely small sizes, since some viewers were failing on such files.
- The rightmost break for the
hist.POSIXlt()has been increased by a day. (Inter alia, fixes PR#15717.)
- The handling of
DF[i,] <- awhere
iis of length 0 is improved. (Inter alia, fixes PR#15718.)
hclust()gains a new method
"ward.D2"which implements Ward’s method correctly. The previous
"ward.D"now, with the old name still working. Thanks to research and proposals by Pierre Legendre.
sunspot.monthdataset has been amended and updated from the official source, whereas the
sunspot.yeardatasets will remain immutable. The documentation and source links have been updated correspondingly.
"lm"fits warns if the fit is essentially perfect, as most of the summary may be computed inaccurately (and with platform-dependent values).Programmers who use
summary()in order to extract just a component which will be reliable (e.g.
$cov.unscaled) should wrap their calls in
INSTALLATION and INCLUDED SOFTWARE
- The included version of LAPACK has been updated to 3.5.0.
- There is some support for parallel testing of an installation, by setting TEST_MC_CORES to an integer greater than one to indicate the maximum number of cores to be used in parallel. (It is worth specifying at least 8 cores if available.) Most of these require a
makeprogram (such as GNU
dmake) which supports the
$MAKE -j nprocsyntax.Except on Windows: the tests of standard package examples in
make checkare done in parallel. This also applies to running
The more time-consuming regression tests are done in parallel.
The package checks in
make check-recommendedare done in parallel.
- More of
make checkwill work if recommended packages are not installed: but recommended packages remain needed for thorough checking of an R build.
- The version of tzcode included in ‘src/extra/tzone’ has been updated. (Formerly used only on Windows.)
- The included (64-bit) time-zone conversion code and Olson time-zone database can be used instead of the system version: use
configureoption –with-internal-tzcode. This is the default on Windows and OS X. (Note that this does not currently work if a non-default
configurevariable is used.)(It might be necessary to set environment variable TZ on OSes where this is not already set, although the system timezone is deduced correctly on at least Linux, OS X and Windows.)
This option also switches to the version of
strftimeincluded in directory ‘src/extra/tzone’.
configurenow tests for a C++11-compliant compiler by testing some basic features. This by default tries flags for the compiler specified by CXX, but an alternative compiler, options and standard can be specified by variables CXX1X, CXX1XFLAGS and CXX1XSTD (e.g. -std=gnu++11).
- R can now optionally be compiled to use reference counting instead of the
NAMEDmechanism by defining
SWITCH_TO_REFCNTin ‘Rinternals.h’. This may become the default in the future.
- There is a new option –use-system-tre to use a suitable system tre library: at present this means a version from their
gitrepository, after corrections. (Wish ofPR#15660.)
CRANextrarepository is no longer a default repository on Windows: all the binary versions of packages from CRAN are now on CRAN, although
CRANextracontains packages from Omegahat and elsewhere used by CRAN packages.
- Only vignettes sources in directory ‘vignettes’ are considered to be vignettes and hence indexed as such.
- In the ‘DESCRIPTION’ file,
is no longer recognized as valid. Use MIT or BSD_2_clause instead, both of which need + file LICENSE.
- For consistency, entries in ‘.Rinstignore’ are now matched case-insensitively on all platforms.
- Help for S4 methods with very long signatures now tries harder to split the description in the Usage field to no more than 80 characters per line (some packages had over 120 characters).
R CMD INSTALL --build(not Windows) now defaults to the internal
tar()unless R_INSTALL_TAR is set.
- There is support for compiling C++11 code in packages on suitable platforms: see ‘Writing R Extensions’.
- Fake installs now install the contents of directory ‘inst’: some packages use this to install e.g. C++ headers for use by other packages that are independent of the package itself. Option –no-inst can be used to get the previous behaviour.
- The behaviour of the code browser has been made more consistent, in part following the suggestions in PR#14985.
- Calls to
browser()are now consistent with calls to the browser triggered by
debug(), in that Enter will default to
- A new browser command
shas been added, to “step into” function calls.
- A new browser command
fhas been added, to “finish” the current loop or function.
- Within the browser, the command
helpwill display a short list of available commands.
- Only vignettes sources in directory ‘vignettes’ are considered to be vignettes by
R CMD check. That has been the preferred location since R 2.14.0 and is now obligatory.
- For consistency,
R CMD buildnow matches entries in ‘.Rbuildignore’ and ‘vignettes/.install_extras’ case-insensitively on all platforms (not just on Windows).
R CMD checkby default) can optionally check foreign function calls for consistency with the registered type and argument count. This is the default for
R CMD check --as-cranor can be enabled by setting environment variable _R_CHECK_FF_CALLS_ to registration (but is in any case suppressed by –install=no). Because this checks calls in which
.NAMEis an R object and not just a literal character string, some other problems are detected for such calls.Functions
dontCheck()have been added to allow package authors to suppress false positive reports.
R CMD check --as-cranwarns about a false value of the ‘DESCRIPTION’ field BuildVignettes for Open Source packages, and ignores it. (An Open Source package needs to have complete sources for its vignettes which should be usable on a suitably well-equipped system).
R CMD check --no-rebuild-vignettesis defunct:
R CMD check --no-build-vignetteshas been preferred since R 3.0.0.
R CMD build --no-vignettesis defunct:
R CMD build --no-build-vignetteshas been preferred since R 3.0.0.
R CMD Sweaveand
R CMD Stanglenow process both Sweave and non-Sweave vignettes. The
tools::buildVignette()function has been added to do the same tasks from within R.
- The flags returned by
R CMD config --ldflagsand (where installed)
pkg-config --libs libRare now those needed to link a front-end against the (shared or static) R library.
- ‘Sweave.sty’ has a new option [inconsolata].
R CMD checkcustomizations such as _R_CHECK_DEPENDS_ONLY_ make available packages only in LinkingTo only for installation, and not for loading/runtime tests.
DUP = FALSEif argument
check_DUPis true. This is selected by
R CMD checkby default.
R CMD check --use-gctcan be tuned to garbage-collect less frequently using
gctorture2()via the setting of environment variable _R_CHECK_GCT_N_.
- Where supported,
tools::texi2dvi()limits the number of passes tried to 20.
- (Windows only) A function
R_WaitEvent()has been added (with declaration in header‘R.h’) to block execution until the next event is received by R.
- Remapping in the ‘Rmath.h’ header can be suppressed by defining R_NO_REMAP_RMATH.
- The remapping of
rround()in header ‘Rmath.h’ has been removed: use
ftrunc()in header ‘Rmath.h’ is now a wrapper for the C99 function
trunc(), which might as well be used in C code:
ftrunc()is still needed for portable C++ code.
- The never-documented remapping of
fprec()in header ‘Rmath.h’ has been removed.
- The included LAPACK subset now contains
- The function
LENGTH()now checks that it is only applied to vector arguments. However, in packages
length()should be used. (In R itself
LENGTH()is a macro without the function overhead of
- Calls to
SET_STRING_ELT()are now checked for indices which are in-range: several packages were writing one element beyond the allocated length.
allocVector3has been added which allows custom allocators to be used for individual vector allocations.
DEPRECATED AND DEFUNCT
chol(pivot = TRUE, LINPACK = TRUE)is defunct.Arguments
svd()are ignored: LAPACK is always used.
.path.package()are defunct: only the versions without the initial dot introduced in R 2.13.0 have ever been in the API.
- Partial matching when using the
$operator on data frames now throws a warning and may become defunct in the future. If partial matching is intended, replace
foo[["bar", exact = FALSE]].
- The long-deprecated use of
\synopsisin the Usage section of ‘.Rd’ files has been removed: such sections are now ignored (with a warning).
package.skeleton()‘s deprecated argument
namespacehas been removed.
- Many methods are no longer exported by package stats. They are all registered on their generic, which should be called rather than calling a method directly.
checkNEWS()in package tools are defunct.
download.file(method = "lynx")is deprecated.
.C(DUP = FALSE)and
.Fortran(DUP = FALSE)are now deprecated, and may be disabled in future versions of R. As their help has long said,
.Call()is much preferred.
R CMD checknotes such usages (by default).
- The workaround of setting R_OSX_VALGRIND has been removed: it is not needed in current valgrind.
lm.wfit()with no non-zero weights gave an array-overrun in the Fortran code and a not very sensible answer. It is now special-cased with a simpler answer (no
- Error messages involving non-syntactic names (e.g. as produced by
`\r`when that object does not exist) now encode the control characters. (Reported by Hadley Wickham.)
getGraphicsEvent()caused 100% usage of one CPU in Windows. (PR#15500)
startargument may now work inside another function (scoping issue).
pbeta()and similar work better for very large (billions)
- Where time zones have changed abbreviations over the years, the software tries to more consistently use the abbreviation appropriate to the time or if that is unknown, the current abbreviation. On some platforms where the C function
tznamevariables the reported abbreviation could have been that of the last time converted.
all.equal(list(1), identity)now works.
- Bug fix for pushing viewports in grid (reported by JJ Allaire and Kevin Ushey).NOTE for anyone poking around within the graphics engine display list (despite the warnings not to) that this changes what is recorded by grid on the graphics engine display list.
- Extra checks have been added for unit resolution and conversion in grid, to catch instances of division-by-zero. This may introduce error messages in existing code and/or produce a different result in existing code (but only where a non-finite location or dimension may now become zero).
- Some bugs in TRE have been corrected by updating from the
gitrepository. This allows R to be installed on some platforms for which this was a blocker (PR#15087 suggests Linux on ARM and HP-UX).
?applied to a call to an S4 generic failed in several cases. (PR#15680)
- The implicit S4 generics for primitives with
...in their argument list were incorrect. (PR#15690)
- Bug fixes to
- The bug fix to
aggregrate()in PR#15004 introduced a new bug in the case of no grouping variables. (PR#15699)
- In rare cases printing deeply nested lists overran a buffer by one byte and on a few platforms segfaulted. (PR#15679)
- The dendrogram method of
as.dendrogram()was hidden accidentally, (PR#15703), and
order.dendrogram(d)gave too much for a leaf
- R would try to kill processes on exit that have pids ever used by a child process spawned by
mcparalleleven though the current process with that pid was not actually its child.
cophenetic()applied to a
"dendrogram"object sometimes incorrectly returned a
"Labels"attribute with dimensions. (PR#15706)
printCoefmat()called from quite a few
print()methods now obeys small
getOption("width")settings, line wrapping the “signif. codes” legend appropriately. (PR#15708)
model.matrix()assumed that the stored dimnames for a matrix was
NULLor length 2, but length 1 occurred.
- The clipping region for a device was sometimes used in base graphics before it was set.