R 3.1.0 (codename “Spring Dance“) was released today!
You can get the source code from
https://cran.r-project.org/src/
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:
source("https://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-on-windows.r.txt")
New.R.RunMe()
CHANGES IN R 3.1.0:
NEW FEATURES
type.convert()
(and hence by defaultread.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, specifycolClasses
inread.table()
to be"numeric"
.tools::Rdiff(useDiff = FALSE)
is closer to the POSIX definition ofdiff -b
(as distinct from the description in theman
pages of most systems).- New function
anyNA()
, a version ofany(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 ofnames(.dimnames)
when available.is.unsorted()
now also works forraw
vectors.- The
"table"
method foras.data.frame()
(also useful asas.data.frame.table()
) now passessep
andbase
arguments toprovideDimnames()
. uniroot()
gets new optional arguments, notablyextendInt
, allowing to auto-extend the search interval when needed. The return value has an extra component,init.it
.switch(f, ...)
now warns whenf
is a factor, as this typically happens accidentally where the useR meant to pass a character string, butf
is 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. colorRamp()
andcolorRampPalette()
now allow non-opaque colours and a ramp in opacity via the new argumentalpha = TRUE
. (Suggested by Alberto Krone-Martins, but optionally as there are existing uses which expect only RGB values.)grid.show.layout()
andgrid.show.viewport()
get an optionalvp.ex
argument.- 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.) object.size()
gains aformat()
method.- There is a new family,
"ArialMT"
, for thepdf()
andpostscript()
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 inputx
(previously user error). (Related to PR#15442.)- Added
utils::fileSnapshot()
andutils::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
cospi(x)
,sinpi(x)
, andtanpi(x)
, for more accurate computation ofcos(pi*x)
, etc, both in R and the C API. Using these gains accuracy in some cases, e.g., insidelgamma()
orbesselI()
. (Suggested by Morten Welinder in PR#15529.) print.table(x, zero.print = ".")
now also has an effect whenx
is 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), andOlsonNames()
lists the names in the system’s Olson database.Sys.timezone(location = FALSE)
gives the previous behaviour. - Platforms with a 64-bit
time_t
type are allowed to handle conversions between the"POSIXct"
and"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.)Currentlytime_t
is usuallylong
and 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). - The
"save.defaults"
option can include a value forcompression_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 whenf
is an unclassed integer vector (for example, when called fromtapply()
).fft()
now works with longer inputs, from the 12 million previously supported up to 2 billion. (PR#15593)- Complex
svd()
now uses LAPACK subroutineZGESDD
, 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
%SweaveUTF8
on a line by itself. file.copy()
gains acopy.date
argument.- 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
strftime
has 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. read.table()
,readLines()
andscan()
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 <- a0
andans[[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. - The
fast
argument ofKalmanLike()
,KalmanRun()
andKalmanForecast()
has been replaced byupdate
, which instead of updatingmod
in place, optionally returns the updated model in an attribute"mod"
of the return value. arima()
andmakeARIMA()
get a new optional argumentSSinit
, 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 argumentnoBreaks.
, to simplify post-processing of output withoptions(warn = 1)
.pushBack()
gains an argumentencoding
, to support reading of UTF-8 characters usingscan()
,read.table()
and related functions in a non-UTF-8 locale.all.equal.list()
gets a new argumentuse.names
which 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
all.equal()
andattr.all.equal()
now have argumentcheck.attributes
after...
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) toall.equal()
are detected and reported.There are explicit checks that
check.attributes
is logical,tolerance
is numeric andscale
isNULL
or numeric. This catches some unintended positional matching.The message for
all.equal.numeric()
reports a"scaled difference"
only forscale != 1
. all.equal()
now has a"POSIXt"
method replacing the"POSIXct"
method.- The
"Date"
and"POSIXt"
methods ofseq()
allowsby = "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
agrepl()
which likegrepl()
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 optiondetach = TRUE
which allows execution of code independently of the current session. It is based on a newestranged = TRUE
argument tomcfork()
which forks child processes such that they become independent of the parent process.- The
pdf()
device omits circles and text at extremely small sizes, since some viewers were failing on such files. - The rightmost break for the
"months"
,"quarters"
and"years"
cases ofhist.POSIXlt()
has been increased by a day. (Inter alia, fixes PR#15717.) - The handling of
DF[i,] <- a
wherei
is 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"
method is"ward.D"
now, with the old name still working. Thanks to research and proposals by Pierre Legendre.- The
sunspot.month
dataset has been amended and updated from the official source, whereas thesunspots
andsunspot.year
datasets will remain immutable. The documentation and source links have been updated correspondingly. - The
summary()
method for"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 usesummary()
in order to extract just a component which will be reliable (e.g.$cov.unscaled
) should wrap their calls insuppressWarnings()
.
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
make
program (such as GNUmake
anddmake
) which supports the$MAKE -j nproc
syntax.Except on Windows: the tests of standard package examples inmake check
are done in parallel. This also applies to runningtools::testInstalledPackages()
.The more time-consuming regression tests are done in parallel.
The package checks in
make check-devel
andmake check-recommended
are done in parallel. - More of
make check
will 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
configure
option –with-internal-tzcode. This is the default on Windows and OS X. (Note that this does not currently work if a non-defaultrsharedir
configure
variable 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
strftime
included in directory ‘src/extra/tzone’. configure
now 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
NAMED
mechanism by definingSWITCH_TO_REFCNT
in ‘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
git
repository, after corrections. (Wish ofPR#15660.)
PACKAGE INSTALLATION
- The
CRANextra
repository is no longer a default repository on Windows: all the binary versions of packages from CRAN are now on CRAN, althoughCRANextra
contains 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,
License: X11
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 internaltar()
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.
DEBUGGING
- 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 bydebug()
, in that Enter will default ton
rather thanc
. - A new browser command
s
has been added, to “step into” function calls. - A new browser command
f
has been added, to “finish” the current loop or function. - Within the browser, the command
help
will display a short list of available commands.
UTILITIES
- 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 build
now matches entries in ‘.Rbuildignore’ and ‘vignettes/.install_extras’ case-insensitively on all platforms (not just on Windows). checkFF()
(called byR CMD check
by default) can optionally check foreign function calls for consistency with the registered type and argument count. This is the default forR CMD check --as-cran
or 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.NAME
is an R object and not just a literal character string, some other problems are detected for such calls.FunctionssuppressForeignCheck()
anddontCheck()
have been added to allow package authors to suppress false positive reports.R CMD check --as-cran
warns 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-vignettes
is defunct:
R CMD check --no-build-vignettes
has been preferred since R 3.0.0.R CMD build --no-vignettes
is defunct:
R CMD build --no-build-vignettes
has been preferred since R 3.0.0.R CMD Sweave
andR CMD Stangle
now process both Sweave and non-Sweave vignettes. Thetools::buildVignette()
function has been added to do the same tasks from within R.- The flags returned by
R CMD config --ldflags
and (where installed)pkg-config --libs libR
are now those needed to link a front-end against the (shared or static) R library. - ‘Sweave.sty’ has a new option [inconsolata].
R CMD check
customizations such as _R_CHECK_DEPENDS_ONLY_ make available packages only in LinkingTo only for installation, and not for loading/runtime tests.tools::checkFF()
reports on.C
and.Fortran
calls withDUP = FALSE
if argumentcheck_DUP
is true. This is selected byR CMD check
by default.R CMD check --use-gct
can be tuned to garbage-collect less frequently usinggctorture2()
via the setting of environment variable _R_CHECK_GCT_N_.- Where supported,
tools::texi2dvi()
limits the number of passes tried to 20.
C-LEVEL FACILITIES
- (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: usefround()
instead. ftrunc()
in header ‘Rmath.h’ is now a wrapper for the C99 functiontrunc()
, which might as well be used in C code:ftrunc()
is still needed for portable C++ code.- The never-documented remapping of
prec()
tofprec()
in header ‘Rmath.h’ has been removed. - The included LAPACK subset now contains
ZGESDD
andZGELSD
. - The function
LENGTH()
now checks that it is only applied to vector arguments. However, in packageslength()
should be used. (In R itselfLENGTH()
is a macro without the function overhead oflength()
.) - Calls to
SET_VECTOR_ELT()
andSET_STRING_ELT()
are now checked for indices which are in-range: several packages were writing one element beyond the allocated length. allocVector3
has been added which allows custom allocators to be used for individual vector allocations.
DEPRECATED AND DEFUNCT
chol(pivot = TRUE, LINPACK = TRUE)
is defunct.ArgumentsEISPACK
foreigen()
andLINPACK
forchol()
,chol2inv()
,solve()
andsvd()
are ignored: LAPACK is always used..find.package()
and.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, replacefoo$bar
byfoo[["bar", exact = FALSE]]
. - The long-deprecated use of
synopsis
in the Usage section of ‘.Rd’ files has been removed: such sections are now ignored (with a warning). package.skeleton()
‘s deprecated argumentnamespace
has 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.
- Functions
readNEWS()
andcheckNEWS()
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 check
notes such usages (by default).- The workaround of setting R_OSX_VALGRIND has been removed: it is not needed in current valgrind.
BUG FIXES
- Calling
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 (noqr
component). - 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)nls()
with nostart
argument may now work inside another function (scoping issue).pbeta()
and similar work better for very large (billions)ncp
.- 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
localtime
changed thetzname
variables 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
git
repository. 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
methods::callGeneric()
. (PR#15691) - 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), andorder.dendrogram(d)
gave too much for a leafd
. (PR#15702) - R would try to kill processes on exit that have pids ever used by a child process spawned by
mcparallel
even 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 fewprint()
methods now obeys smallgetOption("width")
settings, line wrapping the “signif. codes” legend appropriately. (PR#15708)model.matrix()
assumed that the stored dimnames for a matrix wasNULL
or length 2, but length 1 occurred.- The clipping region for a device was sometimes used in base graphics before it was set.
Hi Tal. very pleased to see the explanation. waiting for other interesting posts at a time when that will come.
From bvba Woodstone
Hi Tal. I wanted to switch to upgrading R w/ installr and start using global libraries, but haven’t been successful. I’ve installed R in C:R and have read/write permissions here. I then created a ‘Library’ folder in C:R and copied all libraries from C:RR-3.1.1 to C:RLibrary. But, now when I download/install a package, it still places the package in C:RR-3.1.1library folder and not in the global library folder (C:RLibrary).
Tal, thank you again. Q: should I file a bug report when your skript does not work as intended from RStudio?
I am using the global library system, but the packages are not available after running. I now used the “traditional” way:
setwd(“C:/Program Files/R/library”)
packages <- installed.packages()[,"Package"]
save(packages, file="Rpackages")
#–run in the new version
setwd("C:/Program Files/R/library")
load("Rpackages")
for (p in setdiff(packages, installed.packages()[,"Package"]))
install.packages(p)
# which works, btw. But takes a hell lot of time, and diskspace.