R CMD check skips vignette re-building (with a warning) if the VignetteBuilder package(s) are not available.

regexpr(*, perl=TRUE) no longer returns incorrect positions into text containing characters outside of the Unicode Basic Multilingual Plane on Windows.

on.exit() now correctly matches named arguments, thanks to PR#17815 (including patch) by Brodie Gaslam.

source(*, echo=TRUE) no longer fails in some cases with empty lines; reported by Bill Dunlap in PR#17769 .

The summary(<warnings>) method now maps the counts correctly to the warning messages.

A package whose code uses this should depend on R (>= 4.0.1).

paste() and paste0() gain a new optional argument recycle0 . When set to true, zero-length arguments are recycled leading to character(0) after the sep -concatenation, i.e., to the empty string "" if collapse is a string and to the zero-length value character(0) when collapse = NULL .

Parse data for raw strings is now recorded correctly. Reported by Gabor Csardi.

parallel::detect.cores(all.tests = TRUE) tries a matching OS name before the other tests (which were intended only for unknown OSes).

plot(y ~ x, ylab = quote(y[i])) now works, as e.g., for xlab ; related to PR#10525 .

In R 4.0.0, sort.list(x) when is.object(x) was true, e.g., for x <- I(letters) , was accidentally using method = "radix" . Consequently, e.g., merge(<data.frame>) was much slower than previously; reported in PR#17794 .

Computing the base value, i.e., 2, “everywhere”, now uses FLT_RADIX , as the original ‘machar’ code looped indefinitely on the ppc64 architecture for the longdouble case.

Fix for adding two complex grid units via sum() . Thanks to Gu Zuguang for the report and Thomas Lin Pedersen for the patch.

Fix a dozen places (code, examples) as Sys.setlocale() returns the new rather than the previous setting.

aov(frml, ...) now also works where the formula deparses to more than 500 characters, thanks to a report and patch proposal by Jan Hauffa.

Packages which define S4 generics for plot() should be re-installed and package code using such generics from other packages needs to ensure that they are imported rather than rely on their being looked for on the search path (as in a namespace, the base namespace has precedence over the search path).

The plot() S3 generic function is now in package base rather than package graphics, as it is reasonable to have methods that do not use the graphics package. The generic is currently re-exported from the graphics namespace to allow packages importing it from there to continue working, but this may change in future.

A large number of packages relied on the previous behaviour and so have needed/will need updating.

R now uses a stringsAsFactors = FALSE default, and hence by default no longer converts strings to factors in calls to data.frame() and read.table() .

There is a new syntax for specifying raw character constants similar to the one used in C++: r"(...)" with ... any character sequence not containing the sequence )". This makes it easier to write strings that contain backslashes or both single and double quotes. For more details see ?Quotes .

S3 methods for class "array" are now dispatched for matrix objects.

matrix objects now also inherit from class "array" , so e.g., class(diag(1)) is c("matrix", "array") . This invalidates code incorrectly assuming that class(matrix_obj)) has length one.

Packages need to be (re-)installed under this version (4.0.0) of R .

This change is expected to have almost no impact on packages using supported coding practices in their C/C++ code.

Reference counting is now used instead of the NAMED mechanism for determining when objects can be safely mutated in base C code. This reduces the need for copying in some cases and should allow further optimizations in the future. It should help make the internal code easier to maintain.

Option PCRE_study is no longer used with PCRE2, and is reported as FALSE when that is in use.

PCRE2 reports errors for some regular expressions that were accepted by PCRE1. A hyphen now has to be escaped in a character class to be interpreted as a literal (unless first or last in the class definition). \R, \B and \X are no longer allowed in character classes (PCRE1 treated these as literals).

Making PCRE2 available when building R from source is strongly recommended (preferably version 10.30 or later) as PCRE1 is no longer developed: version 8.44 is ‘likely to be the final release’.

This version of R is built against the PCRE2 library for Perl-like regular expressions, if available. (On non-Windows platforms PCRE1 can optionally be used if PCRE2 is not available at build time.) The version of PCRE in use can be obtained via extSoftVersion() : PCRE1 (formerly known as ‘PCRE’) has versions <= 8, PCRE2 versions >= 10.

assertError() and assertWarning() (in package tools) can now check for specific error or warning classes via the new optional second argument classes (which is not back compatible with previous use of an unnamed second argument).

DF2formula() , the utility for the data frame method of formula() , now works without parsing and explicit evaluation, starting from Suharto Anggono's suggestion in PR#17555.

approxfun() and approx() gain a new argument na.rm defaulting to true. If set to false, missing y values now propagate into the interpolated values.

Long vectors are now supported as the seq argument of a for() loop.

str(x) gets a new deparse.lines option with a default to speed it up when x is a large call object.

The internal traceback object produced when an error is signalled ( .Traceback ), now contains the call s rather than the deparse() d calls, deferring the deparsing to the user-level functions .traceback() and traceback() . This fulfils the wish of PR#17580, reported including two patch proposals by Brodie Gaslam.

data.matrix() now converts character columns to factors and from this to integers.

package.skeleton() now explicitly lists all exports in the ‘NAMESPACE’ file.

New function .S3method() to register S3 methods in R scripts.

file.path() has some support for file paths not in the session encoding, e.g. with UTF-8 inputs in a non-UTF-8 locale the output is marked as UTF-8.

Most functions with file-path inputs will give an explicit error if a file-path input in a marked encoding cannot be translated (to the native encoding or in some cases on Windows to UTF-8), rather than translate to a different file path using escapes. Some (such as dir.exists() , file.exists() , file.access() , file.info() , list.files() , normalizePath() and path.expand() ) treat this like any other non-existent file, often with a warning.

There is a new help document accessed by help("file path encoding") detailing how file paths with marked encodings are handled.

New function list2DF() for creating data frames from lists of variables.

iconv() has a new option sub = "Unicode" to translate UTF-8 input invalid in the to encoding using <U+xxxx> escapes.

There is a new function infoRDS() providing information about the serialization format of a serialized object.

S3 method lookup now by default skips the elements of the search path between the global and base environments.

Added an argument add_datalist(*, small.size = 0) to allow the creation of a ‘data/datalist’ file even when the total size of the data sets is small.

The backquote function bquote() has a new argument splice to enable splicing a computed list of values into an expression, like ,@ in LISP's backquote.

The formula interface to t.test() and wilcox.test() has been extended to handle one-sample and paired tests.

The palette() function has a new default set of colours (which are less saturated and have better accessibility properties). There are also some new built-in palettes, which are listed by the new palette.pals() function. These include the old default palette under the name "R3" . Finally, the new palette.colors() function allows a subset of colours to be selected from any of the built-in palettes.

n2mfrow() gains an option asp = 1 to specify the aspect ratio, fulfilling the wish and extending the proposal of Michael Chirico in PR#17648.

For head(x, n) and tail() the default and other S3 methods notably for vector n , e.g. to get a “corner” of a matrix, has been extended to array 's of higher dimension thanks to the patch proposal by Gabe Becker in PR#17652. Consequently, optional argument addrownums is deprecated and replaced by the (more general) argument keepnums . An invalid second argument n now leads to typically more easily readable error messages.

New function .class2() provides the full character vector of class names used for S3 method dispatch.

Printing methods(..) now uses a new format() method.

sort.list(x) now works for non-atomic objects x and method = "auto" (the default) or "radix" in cases order(x) works, typically via a xtfrm() method.

Where they are available, writeBin() allows long vectors.

New function deparse1() produces one string, wrapping deparse() , to be used typically in deparse1(substitute(*)) , e.g., to fix PR#17671.

wilcox.test() enhancements: In the (non-paired) two-sample case, Inf values are treated as very large for robustness consistency. If exact computations are used, the result now has "exact" in the method element of its return value. New arguments tol.root and digits.rank where the latter may be used for stability to treat very close numbers as ties.

readBin() and writeBin() now report an error for an invalid endian value. The affected code needs to be fixed with care as the old undocumented behavior was to swap endian-ness in such cases.

sequence() is now an S3 generic with an internally implemented default method, and gains arguments to generate more complex sequences. Based on code from the S4Vectors Bioconductor package and the advice of Hervé Pagès.

print() 's default method and many other methods (by calling the default eventually and passing ... ) now make use of a new optional width argument, avoiding the need for the user to set and reset options("width") .

memDecompress() supports the RFC 1952 format (e.g. in-memory copies of gzip -compressed files) as well as RFC 1950.

memCompress() and memDecompress() support long raw vectors for types "gzip" and "zx" .

sweep() and slice.index() can now use names of dimnames for their MARGIN argument ( apply has had this for almost a decade).

New function proportions() and marginSums() . These should replace the unfortunately named prop.table() and margin.table() . They are drop-in replacements, but also add named-margin functionality. The old function names are retained as aliases for back-compatibility.

Functions rbinom() , rgeom() , rhyper() , rpois() , rnbinom(), rsignrank() and rwilcox() which have returned integer since R 3.0.0 and hence NA when the numbers would have been outside the integer range, now return double vectors (without NAs, typically) in these cases.

matplot(x,y) (and hence matlines() and matpoints() ) now call the corresponding methods of plot() and lines() , e.g, when x is a "Date" or "POSIXct" object; prompted by Spencer Graves' suggestion.

stopifnot() now allows customizing error messages via argument names, thanks to a patch proposal by Neal Fultz in PR#17688.

unlink() gains a new argument expand to disable wildcard and tilde expansion. Elements of x of value "~" are now ignored.

mle() in the stats4 package has had its interface extended so that arguments to the negative log-likelihood function can be one or more vectors, with similar conventions applying to bounds, start values, and parameter values to be kept fixed. This required a minor extension to class "mle" , so saved objects from earlier versions may need to be recomputed.

The default for pdf() is now useDingbats = FALSE .

The default fill colour for hist() and boxplot() is now col = "lightgray" .

The default order of the levels on the y-axis for spineplot() and cdplot() has been reversed.

If the R_ALWAYS_INSTALL_TESTS environment variable is set to a true value, R CMD INSTALL behaves as if the --install-tests option is always specified. Thanks to Reinhold Koch for the suggestion.

New function R_user_dir() in package tools suggests paths appropriate for storing R-related user-specific data, configuration and cache files.

capabilities() gains a new logical option Xchk to avoid warnings about X11-related capabilities.

The internal implementation of grid units has changed, but the only visible effects at user-level should be a slightly different print format for some units (especially unit arithmetic),

faster performance (for unit operations) and

two new functions unitType() and unit.psum() . Based on code contributed by Thomas Lin Pedersen.

When internal dispatch for rep.int() and rep_len() fails, there is an attempt to dispatch on the equivalent call to rep() .

Object .Machine now contains new longdouble.* entries (when R uses long doubles internally).

news() has been enhanced to cover the news on R 3.x and 2.x.

For consistency, N <- NULL; N[[1]] <- val now turns N into a list also when val) has length one. This enables dimnames(r1)[[1]] <- "R1" for a 1-row matrix r1 , fixing PR#17719 reported by Serguei Sokol.

deparse(..) , dump(..) , and dput(x, control = "all") now include control option "digits17" which typically ensures 1:1 invertibility. New option control = "exact" ensures numeric exact invertibility via "hexDigits" .

When loading data sets via read.table() , data() now uses LC_COLLATE=C to ensure locale-independent results for possible string-to-factor conversions.

A server socket connection, a new connection type representing a listening server socket, is created via serverSocket() and can accept multiple socket connections via socketAccept() .

New function socketTimeout() changes the connection timeout of a socket connection.

The time needed to start a homogeneous PSOCK cluster on localhost with many nodes has been significantly reduced (package parallel).

New globalCallingHandlers() function to establish global condition handlers. This allows registering default handlers for specific condition classes. Developed in collaboration with Lionel Henry.

New function tryInvokeRestart() to invoke a specified restart if one is available and return without signaling an error if no such restart is found. Contributed by Lionel Henry in PR#17598.

str(x) now shows the length of attributes in some cases for a data frame x .

Rprof() gains a new argument filter.callframes to request that intervening call frames due to lazy evaluation or explicit eval() calls be omitted from the recorded profile data. Contributed by Lionel Henry in PR#17595.

The handling of ${FOO-bar} and ${FOO:-bar} in ‘Renviron’ files now follows POSIX shells (at least on a Unix-alike), so the first treats empty environment variables as set and the second does not. Previously both ignored empty variables. There are several uses of the first form in ‘etc/Renviron’.

New classes argument for suppressWarnings() and suppressMessages() to selectively suppress only warnings or messages that inherit from particular classes. Based on patch from Lionel Henry submitted with PR#17619.

New function activeBindingFunction() retrieves the function of an active binding.

New "cairoFT" and "pango" components in the output of grSoftVersion() .