R 3.2.0 (codename “Full of Ingredients”) was released yesterday. You can get the latest binaries version from here. (or the .tar.gz source code from here). The full list of new features and bug fixes is provided below.
Upgrading to R 3.2.0 on Windows
If you are using Windows you can easily 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"); library(installr) #load / install+load installr updateR() # updating R.
Running “updateR()” will detect if there is a new R version available, and if so it will download+install it (etc.).
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.
CHANGES IN R 3.2.0:
As always, David smith mentioned in his post some of the main changes, writing how many of the changes in this release have happened behind the scenes to improve R’s engine for performance and reliability. These include:
- A number of fixes proposed by Radford Neal, bringing some of the performance improvements of pqR to R while maintaining backwards compatibility.
- more progress in handling big in-memory data objects (for example, you can now cbind/rbind matrices with more than 2 billion elements).
- some significant updates to R’s byte compiler with new instructions that allow many scalar subsetting and assignment and scalar arithmetic operations to be handled more efficiently. This can result in significant performance improvements in scalar numerical code.
- the package-checking system now does a more thorough job of making sure contributed packages comply with CRAN policies.
And here is also the full list of new features, bug fixes, etc:
xis missing and
namesis not false (including the default value),
Sys.getenv(x, names)returns an object of class
"Dlist"and hence prints tidily.
shell()no longer consults the environment variable SHELL: too many systems have been encountered where it was set incorrectly (usually to a path where software was compiled, not where it was installed). R_SHELL, the preferred way to select a non-default shell, can be used instead.
- Some unusual arguments to
embedFonts()can now be specified as character vectors, and the defaults have been changed accordingly.
- Functions in the
Summarygroup duplicate less. (PR#15798)
system(cmd, input = )now uses ‘shell-execution-environment’ redirection, which will be more natural if
cmdis not a single command (but requires a POSIX-compliant shell). (Wish of PR#15508)
fileEncodingargument, for convenience.
- Graphics devices can add attributes to their description in
.Devices. Several of those included with R use a
pmatch()uses hashing in more cases and so is faster at the expense of using more memory. (PR#15697)
pairs()gains new arguments to select sets of variables to be plotted against each other.
file.info(, extra_cols = FALSE)allows a minimal set of columns to be computed on Unix-alikes: on some systems without properly-configured caching this can be significantly faster with large file lists.
- New function
dir.exists()in package base to test efficiently whether one or more paths exist and are directories.
dput()and friends gain new controls hexNumeric and digits17 which output double and complex quantities as, respectively, binary fractions (exactly, see
sprintf("%a")) and as decimals with up to 17 significant digits.
ascii = NAwhich writes ASCII files using
sprintf("%a")for double/complex quantities. This is read-compatible with
ascii = TRUEbut avoids binary->decimal->binary conversions with potential loss of precision. Unfortunately the Windows C runtime’s lack of C99 compliance means that the format cannot be read correctly there in R before 3.1.2.
- The default for
formatC(decimal.mark =)has been changed to be
getOption("OutDec"); this makes it more consistent with
format()and suitable for use in print methods, e.g. those for classes
getOption("OutDec")is now consulted by the print method for class
quantile()when constructing labels and for the report from
legend(trace = TRUE).
(In part, wish of PR#15819.)
formatC()give a warning if
decimal.markare set to the same value (period and comma are not uncommonly used for each, and this is a check that conventions have not got mixed).
merge()can create a result which uses long vectors on 64-bit platforms.
dget()gains a new argument
keep.sourcewhich defaults to
FALSEfor speed (
dget()are most often used for data objects where this can make
dget()many times faster).
- Packages may now use a file of common macro definitions in their help files, and may import definitions from other packages.
- A number of macros have been added in the new ‘share/Rd’ directory for use in package overview help pages, and
promptPackage()now makes use of them.
tools::parse_Rd()gains a new
permissiveargument which converts unrecognized macros into text. This is used by
utils:::format.bibentryto allow LaTeX markup to be ignored.
options(OutDec =)can now specify a multi-byte character, e.g.,
options(OutDec = "u00b7")in a UTF-8 locale.
is.recursive(x)is no longer true when
xis an external pointer, a weak reference or byte code; the first enables
x <- getClass(.).
as.list.environment()gain a new argument
"source"attribute (which has not been added to functions by R since before R version 2.14.0) is no longer treated as special.
returnValue()has been added to give
on.exit()code access to a function’s return value for debugging purposes.
crossprod(x, y)allows more matrix coercions when
yare vectors, now equalling
t(x) %*% yin these cases (also reported by Radford Neal). Similarly,
%*%work in more cases with vector arguments.
- Utility function
dynGet()useful for detecting cycles, aka infinite recursions.
- The byte-code compiler and interpreter include new instructions that allow many scalar subsetting and assignment and scalar arithmetic operations to be handled more efficiently. This can result in significant performance improvements in scalar numerical code.
apply(m, 2, identity)is now the same as the matrix
mwhen it has named row names.
- A new function
debuggingState()has been added, allowing to temporarily turn off debugging.
example()gets a new optional argument
commentDonttest, with a default such that
example(..)in help examples will run
donttestcode only if used interactively (a change in behaviour).
rbind.data.frame()gains an optional argument
make.row.names, for potential speedup.
- New function
extSoftVersion()to report on the versions of third-party software in use in this session. Currently reports versions of
xz, PCRE, ICU, TRE and the
A similar function
grSoftVersion()in package grDevices reports on third-party graphics software.
tcltk::tclVersion()reports the Tcl/Tk version.
callGeneric()without arguments now works with primitive generics to some extent.
vapply(x, FUN, FUN.VALUE)is more efficient notably for large
length(FUN.VALUE); as extension of PR#16061.
as.table()now allows tables with one or more dimensions of length 0 (such as
names(x) <- NULLnow clears the names of call and
library()will report a warning when an insufficient dependency version is masking a sufficient one later on the library search path.
- A new
plot()method for class
"raster"has been added.
check_packages_in_dir_changes()function in package tools for conveniently analyzing how changing sources impacts the check results of their reverse dependencies.
- Speed-up from Peter Haverty for
methods:::.requirePackage()speeding up package loading. (PR#16133)
get()in one call, for efficiency.
envirargument for specifying the environment from which to retrieve the
...in the call, if any; this environment was wrong (or at least undesirable) when the
definitionargument was a function.
topenv()has been made
.Internal()for speedup, based on Peter Haverty’s proposal in PR#16140.
getOption()no longer calls
options()in the main case.
- Optional use of
libcurl(version 7.28.0 from Oct 2012 or later) for Internet access:
capabilities("libcurl")reports if this is available.
libcurlVersion()reports the version in use, and other details of the
"libcurl"build including which URL schemes it supports.
curlGetHeaders()retrieves the headers for
ftps://URLs: analysis of these headers can provide insights into the ‘existence’ of a URL (it might for example be permanently redirected) and is so used in
R CMD check --as-cran.
download.file()has a new optional method
"libcurl"which will handle more URL schemes, follow redirections, and allows simultaneous downloads of multiple URLs.
url()has a new method
"libcurl"which handles more URL schemes and follows redirections. The default method is controlled by a new option
url.method, which applies also to the opening of URLs via
file()(which happens implicitly in functions such as
url()is invoked with a
ftps://URL which the current method cannot handle, it switches to a suitable method if one is available.
- (Windows.) The DLLs ‘internet.dll’ and ‘internet2.dll’ have been merged. In this version it is safe to switch (repeatedly) between the internal and Windows internet functions within an Rsession.
The Windows internet functions are still selected by flag –internet2 or
setInternet2(). This can be overridden for an
url()connection via its new
download.file()has new method
"wininet", selected as the default by –internet2 or
parent.env<-can no longer modify the parent of a locked namespace or namespace imports environment. Contributed by Karl Millar.
- New function
isLoadedNamespace()for readability and speed.
names(env)now returns all the object names of an
env, equivalently to
ls(env, all.names = TRUE, sorted = FALSE)and also to the names of the corresponding list,
names(as.list(env, all.names = TRUE)). Note that although
names()returns a character vector, the names have no particular ordering.
- The memory manager now grows the heap more aggressively. This reduces the number of garbage collections, in particular while data or code are loaded, at the expense of slightly increasing the memory footprint.
- New function
trimws()for removing leading/trailing whitespace.
rbind()now consider S4 inheritance during S3 dispatch and also obey
rbind()will delegate recursively to
methods::rbind2) when at least one argument is an S4 object and S3 dispatch fails (due to ambiguity).
download.file(quiet = FALSE)now uses text rather than Windows progress bars in non-interactive use.
- New function
hsearch_db()in package utils for building and retrieving the help search database used by
help.search(), along with functions for inspecting the concepts and keywords in the help search database.
- New function
.getNamespaceInfo(), a no-check version of
getNamespaceInfo()mostly for internal speedups.
- The help search system now takes keyword entries in Rd files which are not standard keywords (as given in ‘KEYWORDS’ in the R documentation directory) as concepts. For standard keyword entries the corresponding descriptions are additionally taken as concepts.
lengths()function for getting the lengths of all elements in a list.
- New function
toTitleCase()in package tools, tailored to package titles.
- The matrix methods of
rbind()allow matrices as inputs which have 2^31 or more elements. (For
cbind(), wish of PR#16198.)
- The default method of
image()has an explicit check for a numeric or logical matrix (which was always required).
URLencode()will not by default encode further URLs which appear to be already encoded.
BIC(mod, mod2)now give non-NA numbers for
arima()fitted models, as
nobs(mod)now gives the number of “used” observations for such models. This fixes PR#16198, quite differently than proposed there.
"power.htest"objects now have a
digitsargument defaulting to (a function of)
getOption("digits"), and influencing all printed numbers coherently. Unavoidably, this changes the display of such test results in some cases.
- Code completion for namespaces now recognizes all loaded namespaces, rather than only the ones that are also attached.
- The code completion mechanism can now be replaced by a user-specified completer function, for (temporary) situations where the usual code completion is inappropriate.
unzip()will now warn if it is able to detect truncation when unpacking a file of 4GB or more (related to PR#16243).
methods()reports S4 in addition to S3 methods; output is simplified when the
classargument is used.
methods::.S4methods()report S3 and S4 methods separately.
- Higher order functions such as the
Reduce()now force arguments to the functions they apply in order to eliminate undesirable interactions between lazy evaluation and variable capture in closures. This resolves PR#16093.
INSTALLATION and INCLUDED SOFTWARE
donttestsections of R‘s help files can be tested by
make check TEST_DONTTEST=TRUE.
- It is possible to request the use of system
configureoption –with-system-valgrind-headers: note the possible future incompatibility of such headers discussed in the ‘R Installation and Administration’ manual. (Wish of PR#16068.)
- The included version of
liblzmahas been updated to
xz-utils5.0.7 (minor bug fixes from 5.0.5).
configureoptions –with-system-zlib, –with-system-bzlib and –with-system-pcre are now the default. For the time being there is fallback to the versions included in the R sources if no system versions are found or (unlikely) if they are too old.
Linux users should check that the
-devversions of packages zlib, bzip2/libbz2 and pcre as well as xz-devel/liblzma-dev (or similar names) are installed.
configureby default looks for the
texi2anyscript from texinfo 5.1 or later, rather than the
makeinfois a link to the Perl script
texi2anyin texinfo 5.x.)
R CMD INSTALLgains an option –built-timestamp=STAMP allowing 100% reproducible package building, thanks to Dirk Eddelbuettel.
- There is support for testing the
donttestparts of examples in packages.
tools::testInstalledPackage()accepts new arguments
commentDontrun = FALSEand
commentDonttest = FALSE.
R CMD checkgains options –run-dontrun and –run-donttest.
- The HTML generated by
tools::toHTML()methods is now ‘XHTML 1.0 Strict’.
- The compiler package’s utility function
setCompilerOptions()now returns the old values invisibly. The initial optimization level can also be set with the environment variableR_COMPILER_OPTIMIZE.
R CMD buildadds a NeedsCompilation field if one is not already present in the ‘DESCRIPTION’ file.
R CMD checkgains option –test-dir to specify an alternative set of tests to run.
R CMD checkwill now by default continue with testing after many types of errors, and will output a summary count of errors at the end if any have occurred.
R CMD checknow checks that the Title and Description fields are correctly terminated.
R CMD check --as-crannow:
- checks a ‘README.md’ file can be processed: this needs
- checks the existence and accessibility of URLs in the ‘DESCRIPTION’, ‘CITATION’, ‘NEWS.Rd’ and ‘README.md’ files and in the help files (provided the build has
- reports non-ASCII characters in R source files when there is no package encoding declared in the ‘DESCRIPTION’ file.
- reports (apparent) S3 methods exported but not registered.
- reports overwriting registered S3 methods from base/recommended packages. (Such methods are replaced in the affected package for the rest of the session, even if the replacing namespace is unloaded.)
- reports if the
Titlefield does not appear to be in title case (see ‘Writing R Extensions’: there may be false positives, but note that technical words should be single-quoted and will then be accepted).
Most of these checks can also be selected by environment variables: see the ‘R Internals’ manual.
- checks a ‘README.md’ file can be processed: this needs
- New C API utility
- Entry points
rmultinomare remapped (by default) to
Rf_rbinom_muetc. This requires packages using them to be re-installed.
.C(DUP = FALSE)and
.Fortran(DUP = FALSE)are now ignored, so arguments are duplicated if
DUP = TRUEwould do so. As their help has long said,
.Call()is much preferred.
- New entry point
R_allocbut guaranteed to have sufficient alignment for
WINDOWS BUILD CHANGES
A number of changes to the Windows build system are in development. The following are currently in place.
- Installation using external binary distributions of zlib, bzip2, liblzma, pcre, libpng, jpeglib and libtiff is now required, and the build instructions have been revised.
- A new
rsync-extsofthas been added to obtain copies of the external libraries from CRAN.
- Building the manuals now requires
texi2anyfrom texinfo 5.1 or later. CRAN binary builds include the manuals, but by default builds from source will not, and they will be accessed fromCRAN. See the comments in ‘src/gnuwin32/MkRules.dist’ for how to specify the location of
- (Windows) Changes have been made to support an experimental Windows toolchain based on GCC 4.9.2. The default toolchain continues to be based on GCC 4.6.3, as the new toolchain is not yet stable enough. A change to a new toolchain is expected during the R 3.2.x lifetime.
- (Windows) The use of macro
ZLIB_LIBSin file ‘src/Makevars.win’ (which has not been documented for a long time) now requires an external ‘libz.a’ to be available (it is part of the ‘goodies’ used to compile Windows binary packages). It would be simpler to use
- The default for option
pkgTypeon platforms using binary packages is now
"both", so source packages will be tried if binary versions are not available or not up to date.
There are options for what
install.packages(type = "both")(possibly called via
update.packages()) will do if compilation of a source package is desirable: see
If you intend not to accept updates as source packages, you should use
update.packages(type = "binary").
DEPRECATED AND DEFUNCT
download.file(method = "lynx")is defunct.
- Building R using the included versions of
xzand PCRE is deprecated: these are frozen (bar essential bug-fixes) and will be removed for R 3.3.0.
configureoption –with-valgrind-instrumentation=3 has been withdrawn, as it did not work with recent
valgrindheaders: it is now treated as level
MethodsListclass in package methods had been deprecated in R 2.11.0 and is defunct now. Functions using it are defunct if they had been deprecated in R 2.11.0, and are deprecated now, otherwise.
- Fixed two obscure bugs in pairlist subassignment, reported by Radford Neal as part of pqR issue 16.
- Fixes for bugs in handling empty arguments and argument matching by name in
all.equal()gains methods for
data.framemethods to avoid corruption of S4 class information by the S3 methods.
callNextMethod()should now work within a
...is absent from
dput(pairlist(x))generates a call to the
pairlistconstructor instead of the
missing()when arguments are propagated through
eigen(m)now defaults to
symmetric = TRUEeven when the dimnames are asymmetric if the matrix is otherwise symmetric. (PR#16151)
- Fix issues with forwarding
callGeneric()now works after a
- Subclass information is kept consistent when replacing an ordinary S4 class with an “old class” via the
setOldClass(). Thus, for example, a
data.frameis valid for a
listargument in the signature, and a
factoris valid for
qbeta()the inversion of
pbeta()is much more sophisticated. This works better in corner cases some of which failed completely previously (PR#15755), or were using too many iterations.
- Auto-printing no longer duplicates objects when printing is dispatched to a method.
kmeans(x, k)would fail when
nrow(x) >= 42949673. (Comment 6 of PR#15364)
- ‘Abbreviated’ locale-specific day and month names could have been truncated in those rare locales where there are the same as the full names.
- An irrelevant warning message from updating subclass information was silenced (the namespace would not be writable in this case).