R 4.1.0 is now the default version on migale
3.13
CHANGES IN R 4.1.0
FUTURE DIRECTIONS
-
It is planned that the 4.1.x series will be the last to support 32-bit Windows, with production of binary packages for that series continuing until early 2023.
SIGNIFICANT USER-VISIBLE CHANGES
-
Data set
esoph
in package datasets now provides the correct numbers of controls; previously it had the numbers of cases added to these. (Reported by Alexander Fowler in PR#17964.)
NEW FEATURES
-
www.omegahat.net is no longer one of the repositories known by default to
setRepositories()
. (Nowadays it only provides source packages and is often unavailable.) -
Function
package_dependencies()
(in package tools) can now use different dependency types for direct and recursive dependencies. -
The checking of the size of tarball in
R CMD check --as-cran <pkg>
may be tweaked via the new environment variable _R_CHECK_CRAN_INCOMING_TARBALL_THRESHOLD_, as suggested in PR#17777 by Jan Gorecki. -
Using
c()
to combine a factor with other factors now gives a factor, an ordered factor when combining ordered factors with identical levels. -
apply()
gains asimplify
argument to allow disabling of simplification of results. -
The
format()
method for class"ftable"
gets a new optionjustify
. (Suggested by Thomas Soeiro.) -
New
...names()
utility. (Proposed by Neal Fultz in PR#17705.) -
type.convert()
now warns when itsas.is
argument is not specified, as the help file always said it should. In that case, the default is changed toTRUE
in line with its change inread.table()
(related tostringsAsFactor
) in R 4.0.0. -
When printing list arrays, classed objects are now shown via their
format()
value if this is a short enough character string, or by giving the first elements of their class vector and their length. -
capabilities()
gets new entry"Rprof"
which isTRUE
when R has been configured with the equivalent of--enable-R-profiling
(as it is by default). (Related to Michael Orlitzky's report PR#17836.) -
str(xS4)
now also shows extraneous attributes of an S4 objectxS4
. -
Rudimentary support for vi-style tags in
rtags()
andR CMD rtags
has been added. (Based on a patch from Neal Fultz in PR#17214.) -
checkRdContents()
is now exported from tools; it and alsocheckDocFiles()
have a new optionchkInternal
allowing to check Rd files marked with keyword"internal"
as well. The latter can be activated forR CMD check
via environment variable _R_CHECK_RD_INTERNAL_TOO_. -
New functions
numToBits()
andnumToInts()
extend theraw
conversion utilities to (double precision)numeric
. -
Functions
URLencode()
andURLdecode()
in package utils now work on vectors of URIs. (Based on patch from Bob Rudis submitted with PR#17873.) -
path.expand()
can expand ~user on most Unix-alikes even whenreadline
is not in use. It tries harder to expand ~, for example should environment variable HOME be unset. -
For HTML help (both dynamic and static), Rd file links to help pages in external packages are now treated as references to topics rather than file names, and fall back to a file link only if the topic is not found in the target package. The earlier rule which prioritized file names over topics can be restored by setting the environment variable _R_HELP_LINKS_TO_TOPICS_ to a false value.
-
c()
now removesNULL
arguments before dispatching to methods, thus simplifying the implementation ofc()
methods, but for back compatibility keepsNULL
when it is the first argument. (From a report and patch proposal by Lionel Henry in PR#17900.) -
Vectorize()
's result function's environment no longer keeps unneeded objects. -
Function
...elt()
now propagates visibility consistently with..n
. (Thanks to Lionel Henry's PR#17905.) -
capture.output()
no longer uses non-standard evaluation to evaluate its arguments. This makes evaluation of functions likeparent.frame()
more consistent. (Thanks to Lionel Henry's PR#17907.) -
packBits(bits, type="double")
now works as inverse ofnumToBits()
. (Thanks to Bill Dunlap's proposal in PR#17914.) -
curlGetHeaders()
has two new arguments,timeout
to specify the timeout for that call (overridinggetOption("timeout")
) andTLS
to specify the minimum TLS protocol version to be used forhttps://
URIs (inter alia providing a means to check for sites using deprecated TLS versions 1.0 and 1.1). -
For
nls()
, an optional constantscaleOffset
may be added to the denominator of the relative offset convergence test for cases where the fit of a model is expected to be exact, thanks to a proposal by John Nash.nls(*, trace=TRUE)
now also shows the convergence criterion. -
Numeric differentiation via
numericDeriv()
gets new optional argumentseps
andcentral
, the latter for taking central divided differences. The latter can be activated fornls()
vianls.control(nDcentral = TRUE)
. -
nls()
now passes thetrace
andcontrol
arguments togetInitial()
, notably for all self-starting models, so these can also be fit in zero-noise situations via ascaleOffset
. For this reason, theinitial
function of aselfStart
model must now have...
in its argument list. -
bquote(splice = TRUE)
can now splice expression vectors with attributes: this makes it possible to splice the result ofparse(keep.source = TRUE)
. (Report and patch provided by Lionel Henry in PR#17869.) -
textConnection()
gets an optionalname
argument. -
get()
,exists()
, andget0()
now signal an error if the first argument has length greater than 1. Previously additional elements were silently ignored. (Suggested by Antoine Fabri on R-devel.) -
R now provides a shorthand notation for creating functions, e.g.
\(x) x + 1
is parsed asfunction(x) x + 1
. -
R now provides a simple native forward pipe syntax
|>
. The simple form of the forward pipe inserts the left-hand side as the first argument in the right-hand side call. The pipe implementation as a syntax transformation was motivated by suggestions from Jim Hester and Lionel Henry. -
all.equal(f, g)
forfunction
s now by default also compares theirenvironment(.)
s, notably via newall.equal
method for classfunction
. Comparison ofnls()
fits, e.g., may now needall.equal(m1, m2, check.environment = FALSE)
. -
.libPaths()
gets a new optioninclude.site
, allowing to not include the site library. (Thanks to Dario Strbenac's suggestion and Gabe Becker's PR#18016.) -
Lithuanian translations are now available. (Thanks to Rimantas Žakauskas.)
-
names()
now works forDOTSXP
objects. On the other hand, in ‘R-lang’, the R language manual, we now warn against relying on the structure or even existence of suchdot-dot-dot
objects. -
all.equal()
no longer gives an error onDOTSXP
objects. -
capabilities("cairo")
now applies only to the file-based devices as it is now possible (if very unusual) to build R with Cairo support for those but not forX11()
. -
There is optional support for tracing the progress of
loadNamespace()
— see its help. -
(Not Windows.)
l10n_info()
reports an additional element, the name of the encoding as reported by the OS (which may differ from the encoding part (if any) of the result fromSys.getlocale("LC_CTYPE")
. -
New function
gregexec()
which generalizesregexec()
to find all disjoint matches and well as all substrings corresponding to parenthesized subexpressions of the given regular expression. (Contributed by Brodie Gaslam.) -
New function
charClass()
in package utils to query the wide-character classification functions in use (such asiswprint
). -
The names of
quantile()
's result no longer depend on the globalgetOption("digits")
, butquantile()
gets a new optional argumentdigits = 7
instead. -
grep()
,sub()
,regexp
and variants work considerably faster for long factors with few levels. (Thanks to Michael Chirico's PR#18063.) -
Provide grouping of
x11()
graphics windows within a window manager such asGnome
orUnity
; thanks to a patch by Ivan Krylov posted to R-devel. -
The
split()
method for classdata.frame
now allows thef
argument to be specified as a formula. -
sprintf
now warns on arguments unused by the format string. -
New palettes
"Rocket"
and"Mako"
forhcl.colors()
(approximating palettes of the same name from the 'viridisLite' package).Contributed by Achim Zeileis.
-
The base environment and its namespace are now locked (so one can no longer add bindings to these or remove from these).
-
Rterm
handling of multi-byte characters has been improved, allowing use of such characters when supported by the current locale. -
Rterm
now acceptsALT+ +xxxxxxxx
sequences to enter Unicode characters as hex digits. -
Environment variable LC_ALL on Windows now takes precedence over LC_CTYPE and variables for other supported categories, matching the POSIX behaviour.
-
duplicated()
andanyDuplicated()
are now optimized for integer and real vectors that are known to be sorted via the ALTREP framework. Contributed by Gabriel Becker via PR#17993.
GRAPHICS
-
The graphics engine version,
R_GE_version
, has been bumped to14
and so packages that provide graphics devices should be reinstalled. -
Graphics devices should now specify
deviceVersion
to indicate what version of the graphics engine they support. -
Graphics devices can now specify
deviceClip
. IfTRUE
, the graphics engine will never perform any clipping of output itself.The clipping that the graphics engine does perform (for both
canClip = TRUE
andcanClip = FALSE
) has been improved to avoid producing unnecessary artifacts in clipped output. -
The grid package now allows
gpar(fill)
to be alinearGradient()
, aradialGradient()
, or apattern()
. Theviewport(clip)
can now also be a grob, which defines a clipping path, and there is a newviewport(mask)
that can also be a grob, which defines a mask.These new features are only supported so far on the Cairo-based graphics devices and on the
pdf()
device. -
(Not Windows.) A warning is given when a Cairo-based type is specified for a
png()
,jpeg()
,tiff()
orbmp()
device but Cairo is unsupported (sotype = "Xlib"
is tried instead). -
grSoftVersion()
now reports the versions of FreeType and FontConfig if they are used directly (not via Pango), as is most commonly done on macOS.
C-LEVEL FACILITIES
-
The standalone ‘libRmath’ math library and R's C API now provide
log1pexp()
again as documented, and gainlog1mexp()
.
UTILITIES
-
R CMD check
can now scan package functions for bogusreturn
statements, which were possibly intended asreturn()
calls (wish of PR#17180, patch by Sebastian Meyer). This check can be activated via the new environment variable _R_CHECK_BOGUS_RETURN_, true for--as-cran
. -
R CMD build
omits tarballs and binaries of previous builds from the top-level package directory. (PR#17828, patch by Sebastian Meyer.) -
R CMD check
now runs sanity checks on the use of LazyData, for example that a ‘data’ directory is present and that LazyDataCompression is not specified without LazyData and has a documented value. For packages with large LazyData databases without specifying LazyDataCompression, there is a reference to the code given in ‘Writing R Extensions’ §1.1.6 to test the choice of compression (as in all the CRAN packages tested a non-default method was preferred). -
R CMD build
removes LazyData and LazyDataCompression fields from the ‘DESCRIPTION’ file of packages without a ‘data’ directory.
ENCODING-RELATED CHANGES
-
The parser now treats \Unnnnnnnn escapes larger than the upper limit for Unicode points (\U10FFFF) as an error as they cannot be represented by valid UTF-8.
Where such escapes are used for outputting non-printable (including unassigned) characters, 6 hex digits are used (rather than 8 with leading zeros). For clarity, braces are used, for example \U{0effff}.
-
The parser now looks for non-ASCII spaces on Solaris (as previously on most other OSes).
-
There are warnings (including from the parser) on the use of unpaired surrogate Unicode points such as \uD834. (These cannot be converted to valid UTF-8.)
-
Functions
nchar()
,tolower()
,toupper()
andchartr()
and those using regular expressions have more support for inputs with a marked Latin-1 encoding. -
The character-classification functions used (by default) to replace the system
iswxxxxx
functions on Windows, macOS and AIX have been updated to Unicode 13.0.0.The character-width tables have been updated to include new assignments in Unicode 13.0.0.
-
The code for evaluating default (extended) regular expressions now uses the same character-classification functions as the rest of R (previously they differed on Windows, macOS and AIX).
-
There is a build-time option to replace the system's wide-character
wctrans
C function by tables shipped with R: useconfigure
option --with-internal-towlower or (on Windows) -DUSE_RI18N_CASE in CFLAGS when building R. This may be needed to allowtolower()
andtoupper()
to work with Unicode characters beyond the Basic Multilingual Plane where not supported by system functions (e.g. on Solaris where it is the new default). -
R is more careful when truncating UTF-8 and other multi-byte strings that are too long to be printed, passed to the system or libraries or placed into an internal buffer. Truncation will no longer produce incomplete multibyte characters.
DEPRECATED AND DEFUNCT
-
Function
plclust()
from the package stats andpackage.dependencies()
,pkgDepends()
,getDepList()
,installFoundDepends()
, andvignetteDepends()
from package tools are defunct. -
Defunct functions
checkNEWS()
andreadNEWS()
from package tools andCRAN.packages()
from utils have been removed. -
R CMD config CXXCPP
is defunct (it was deprecated in R 3.6.2). -
parallel::detectCores()
drops support for Irix (retired in 2013). -
The
LINPACK
argument tochol.default()
,chol2inv()
,solve.default()
andsvd()
has been defunct since R 3.1.0. It was silently ignored up to R 4.0.3 but now gives an error. -
Subsetting/indexing, such as
ddd[*]
orddd$x
on aDOTSXP
(dot-dot-dot) objectddd
has been disabled; it worked by accident only and was undocumented.
BUG FIXES
-
Many more C-level allocations (mainly by
malloc
andstrdup
) are checked for success with suitable alternative actions. -
Bug fix for
replayPlot()
; this was turning off graphics engine display list recording if a recorded plot was replayed in the same session. The impact of the bug became visible if resize the device after replay OR if attempted anothersavePlot()
after replay (empty display list means empty screen on resize or empty saved plot). -
R CMD check
etc now warn when a package exports non-existing S4 classes or methods, also in case of no “methods” presence. (Reported by Alex Bertram; reproducible example and patch by Sebastian Meyer in PR#16662.) -
boxplot()
now also acceptscall
s for labels such asylab
, the same asplot()
. (Reported by Marius Hofert.) -
The help page for
xtabs()
now correctly states thataddNA
is settingna.action = na.pass
among others. (Reported as PR#17770 by Thomas Soeiro.) -
The
R CMD check <pkg>
gives a longer and more comprehensible message when ‘DESCRIPTION’ misses dependencies, e.g., inImports:
. (Thanks to the contributors of PR#17179.) -
update.default()
now calls the genericupdate()
on the formula to work correctly for models with extended formulas. (As reported and suggested by Neal Fultz in PR#17865.) -
The horizontal position of leaves in a dendrogram is now correct also with
center = FALSE
. (PR#14938, patch from Sebastian Meyer.) -
all.equal.POSIXt()
no longer warns about and subsequently ignores inconsistent"tzone"
attributes, but describes the difference in its return value (PR#17277). This check can be disabled via the new argumentcheck.tzone = FALSE
as suggested by Sebastian Meyer. -
as.POSIXct()
now populates the"tzone"
attribute from itstz
argument whenx
is a logical vector consisting entirely ofNA
values. -
x[[2^31]] <- v
now works. (Thanks to the report and patch by Suharto Anggono in PR#17330.) -
In log-scale graphics,
axis()
ticks and label positions are now computed more carefully and symmetrically in their range, typically providing more ticks, fulfilling wishes in PR#17936. The change really corresponds to an improvedaxisTicks()
(package grDevices), potentially influencing grid and lattice, for example. -
qnorm(<very large negative>, log.p=TRUE)
is now correct to at least five digits where it was catastrophically wrong, previously. -
sum(df)
and similar"Summary"
- and"Math"
-group member functions now work for data framesdf
withlogical
columns, notably also of zero rows. (Reported to R-devel by Martin “b706”.) -
unsplit()
had trouble with tibbles due to unsound use ofrep(NA, len)
-indexing, which should useNA_integer_
(Reported to R-devel by Mario Annau.) -
pnorm(x, log.p = TRUE)
underflows to-Inf
slightly later. -
show(<hidden S4 generic>)
prints better and without quotes for non-hidden S4 generics. -
read.table()
and relatives treated an "NA" column name as missing whencheck.names = FALSE
PR#18007. -
Parsing strings containing UTF-16 surrogate pairs such as
"\uD834\uDD1E"
works better on some (uncommon) platforms.sprintf("%X", utf8ToInt("\uD834\uDD1E"))
should now give"1D11E"
on all platforms. -
identical(x,y)
is no longer true for differingDOTSXP
objects, fixing PR#18032. -
str()
now works correctly for DOTSXP and related exotics, even when these are doomed.Additionally, it no longer fails for
list
s with aclass
and “irregular” method definitions such that e.g.lapply(*)
will necessarily fail, as currently for different igraph objects. -
Too long lines in environment files (e.g.
Renviron
) no longer crash R. This limit has been increased to 100,000 bytes. (PR#18001.) -
There is a further workaround for FreeType giving incorrect italic font faces with cairo-based graphics devices on macOS.
-
add_datalist(*, force = TRUE)
(from package tools) now actually updates an existing ‘data/datalist’ file for new content. (Thanks to a report and patch by Sebastian Meyer in PR#18048.) -
cut.Date()
andcut.POSIXt()
could produce an empty last interval forbreaks = "months"
orbreaks = "years"
. (Reported as PR#18053 by Christopher Carbone.) -
Detection of the encoding of ‘regular’ macOS locales such as en_US (which is UTF-8) had been broken by a macOS change: fortunately these are now rarely used with en_US.UTF-8 being preferred.
-
sub()
andgsub(pattern, repl, x, *)
now keep attributes ofx
such asnames()
also whenpattern
isNA
(PR#18079). -
Time differences (
"difftime"
objects) get a replacement and arep()
method to keep"units"
consistent. (Thanks to a report and patch by Nicolas Bennett in PR#18066.) -
The
\RdOpts
macro, setting defaults for\Sexpr
options in an Rd file, had been ineffective since R 2.12.0: it now works again. (Thanks to a report and patch by Sebastian Meyer in PR#18073.) -
mclapply
andpvec
no longer accidentally terminate parallel processes started before bymcparallel
or related calls in package parallel (PR#18078). -
grep
and other functions for evaluating (extended) regular expressions handle in Unicode also strings not explicitly flagged UTF-8, but flagged native when running in UTF-8 locale. -
Fixed a crash in
fifo
implementation on Windows (PR#18031). -
Binary mode in
fifo
on Windows is now properly detected from argumentopen
(PR#15600, PR#18031).
BIOCONDUCTOR Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.0 (2021-05-18)