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
colClasses in read.table() to be "numeric".
* tools::Rdiff(useDiff = FALSE) is closer to the POSIX definition
of diff -b (as distinct from the description in the man pages of
* New function anyNA(), a version of any(is.na(.)) which is fast
for atomic vectors, based on a proposal by Tim Hesterberg. (Wish
* arrayInd(*, useNames = TRUE) and, analogously, which(*, arr.ind =
TRUE) now make use of names(.dimnames) when available.
* is.unsorted() now also works for raw vectors.
* The "table" method for as.data.frame() (also useful as
as.data.frame.table()) now passes sep and base arguments to
* uniroot() gets new optional arguments, notably extendInt,
allowing to auto-extend the search interval when needed. The
return value has an extra component, init.it.
* switch(f, ...) now warns when f is a factor, as this typically
happens accidentally where the useR meant to pass a character
string, but f 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() and 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.layout() and grid.show.viewport() get an optional vp.ex
* 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 a format() method.
* There is a new family, "ArialMT", for the pdf() and 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.)
* Added utils::fileSnapshot() and 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 cospi(x), sinpi(x), and 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 lgamma() or
besselI(). (Suggested by Morten Welinder in PR#15529.)
* print.table(x, zero.print = ".") now also has an effect when x is
* 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
* 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
Currently time_t is usually long 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 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 f is an unclassed integer vector (for
example, when called from tapply()).
* fft() now works with longer inputs, from the 12 million
previously supported up to 2 billion. (PR#15593)
* Complex 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 %\SweaveUTF8 on a line by itself.
* file.copy() gains a copy.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 or WEST. 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
* 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
* read.table(), readLines() and 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 <- a0 and 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.
* The fast argument of KalmanLike(), KalmanRun() and
KalmanForecast() has been replaced by update, which instead of
updating mod in place, optionally returns the updated model in an
attribute "mod" of the return value.
* arima() and makeARIMA() get a new optional argument SSinit,
allowing the choice of a different *s*tate *s*pace 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 scan(), read.table() and related functions
in a non-UTF-8 locale.
* all.equal.list() gets a new argument use.names which by default
labels differing components by names (if they match) rather than
by integer index. Saved R output in packages may need to be
* The methods for all.equal() and attr.all.equal() now have
argument check.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) to all.equal()
are detected and reported.
There are explicit checks that check.attributes is logical,
tolerance is numeric and scale is NULL or numeric. This catches
some unintended positional matching.
The message for all.equal.numeric() reports a "scaled difference"
only for scale != 1.
* all.equal() now has a "POSIXt" method replacing the "POSIXct"
* The "Date" and "POSIXt" methods of seq() allows 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
* New function agrepl() which like grepl() returns a logical
* fifo() is now supported on Windows. (PR#15600)
* sort.list(method = "radix") now allows negative integers (wish of
* Some functionality of print.ts() is now available in
.preformat.ts() for more modularity.
* mcparallel() gains an option detach = TRUE which allows execution
of code independently of the current session. It is based on a
new estranged = TRUE argument to mcfork() which forks child
processes such that they become independent of the parent
* 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 of hist.POSIXlt() has been increased by a day. (Inter
alia, fixes PR#15717.)
* The handling of DF[i,] <- a where i 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 the sunspots and sunspot.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 use summary() in order to extract just a
component which will be reliable (e.g. $cov.unscaled) should wrap
their calls in suppressWarnings().
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 GNU make and dmake) which supports the
$MAKE -j nproc syntax.
Except on Windows: the tests of standard package examples in make
check are done in parallel. This also applies to running
The more time-consuming regression tests are done in parallel.
The package checks in make check-devel and make 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-default rsharedir 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
* 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 defining SWITCH_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 of PR#15660.)
* The CRANextra repository is no longer a default repository on
Windows: all the binary versions of packages from CRAN are now on
CRAN, although CRANextra 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,
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 n rather than
* A new browser command s has been added, to "step into" function
* 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
* 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 by R CMD check by 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-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.
Functions suppressForeignCheck() and dontCheck() 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
* R CMD check --no-rebuild-vignettes is defunct:
R CMD check --no-build-vignettes has been preferred since R
* R CMD build --no-vignettes is defunct:
R CMD build --no-build-vignettes has been preferred since R
* R CMD Sweave and R CMD Stangle now 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 --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 with DUP =
FALSE if argument check_DUP is true. This is selected by R CMD
check by default.
* R CMD check --use-gct can be tuned to garbage-collect less
frequently using gctorture2() _via_ the setting of environment
* Where supported, tools::texi2dvi() limits the number of passes
tried to 20.
* (Windows only) A function R_WaitEvent() has been added (with
declaration in headerR.h) to block execution until the next event
is received by R.
* Remapping in the Rmath.h header can be suppressed by defining
* 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 prec() to fprec() in header
Rmath.h has been removed.
* The included LAPACK subset now contains ZGESDD and ZGELSD.
* 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_VECTOR_ELT() and SET_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.
Arguments EISPACK for eigen() and LINPACK for chol(), chol2inv(),
solve() and svd() 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, replace foo$bar by foo[["bar", exact =
* The long-deprecated use of \synopsis in the Usage section of .Rd
files has been removed: such sections are now ignored (with a
* package.skeleton()'s deprecated argument namespace has been
* 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() and checkNEWS() in package tools are
* 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.
* 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 (no qr 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.
* nls() with no start argument may now work inside another function
* 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 the tzname 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
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
* ? applied to a call to an S4 generic failed in several cases.
which this was a blocker (PR#15087 suggests Linux on ARM and
* ? applied to a call to an S4 generic failed in several cases.
* 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), and order.dendrogram(d) gave too much for a leaf d.
* 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.
* 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
NULL or length 2, but length 1 occurred.
* The clipping region for a device was sometimes used in base
graphics before it was set.
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: email@example.com Priv: PDalgd@gmail.com