The ‘Changes in R 2.9.0’ article from the 2009-1 issue.
new anyDuplicated(x)
returns 0 (= FALSE
) or the index of the
first duplicated entry of x
.
matplot()
, matlines()
and matpoints()
now also obey a ‘lend’
argument, determining line end styles. (Wish of PR#13619.)
The argument was not handled properly when was found in the
enclosure of the current function, rather than in the function
header itself. (This caused integrate()
to fail in certain cases.)
col2rgb("#00000080", TRUE)
would return the background colour.
(Reported by Hadley Wickham.)
interaction()
now ensures that its result’s levels are unique.
packageDescription()
and hence sessionInfo()
now report the
correct package version also for a non-attached loaded namespace of
a version different from the default lib.loc
.
smoothScatter()
now also works when e.g. xlim[2] < xlim[1]
.
parse_Rd()
would mishandle closing braces when they occurred at
the start of a line within an R string in an Rd
file. (Reported by
Alex Couture-Beil.)
readNEWS()
missed version numbers with more than one digit.
building R no longer fails (PR#13665).
printCoefmat(cbind(0,1)
) now works too (PR#13677).
expand.grid()
by default no longer coerces strings into factors.Package Matrix is now a recommended package contained in the basic R distribution. It provides S4 classes and methods for dense and sparse matrices, often by using the numerical libraries Lapack and from the SuiteSparse collection CHOLMOD, CSparse, and SPQR among others.
pdf()
and postscript()
gain a useKerning
argument to place
strings using kerning (which had previously been ignored in display
but not in strwidth
), based in part on an idea and code from Ei-ji
Nakama. The default is TRUE
.
Kerning involving spaces is now ignored (it was previously only used in the computation of string widths).
seq.default()
and seq.int()
ensure that the result is within the
interval [from, to]
even when the last value would previously have
been slightly out of range because of the allowance for rounding
error in computing the number of elements.
boxplot()
gains a simple "matrix"
method, enabling
boxplot(mat)
instead of boxplot(data.frame(mat)
).
zip.file.extract()
gains an optional dir
argument (but use
unzip()
instead).
source()
with encoding
specified (and not as "unknown") marks
the encoding of character strings in Latin-1 and UTF-8 locales.
parse(text=z)
now marks the encoding of character strings in
Latin-1 and UTF-8 locales if z
is of known encoding (that is all
elements are either ASCII or marked as Latin-1 or UTF-8).
sprintf()
does stricter error checking on input formats to avoid
passing invalid formats to the OS (which have a tendency to crash
under such inputs).
expand.grid()
gains a stringsAsFactor
argument to ask for
automatic conversion of character vectors to factors (which happened
for many years but was not previously documented, and is no longer
the default).
bxp()
now computes the ylim
including the outliers only if
outline = TRUE
. (Wish of PR#13196.)
barplot()
gains a args.legend
argument. (Wish of PR#13265.)
RweaveLatexSetup()
now accepts all (and not just some) options
passed through from Sweave()
.
cumsum(x)
and cumprod(x)
for double precision x
now use a long
double accumulator where available and so more closely match sum()
and prod()
in potentially being more accurate.
plot()
methods for "stepfun"
(and hence "ecdf"
) gain a col
argument, allowing to set all three colors simultaneously.
Iterating over a factor in a for loop now coerces to a character vector (rather than using the integer codes).
data.frame()
now recycles columns of list arguments, not just
vectors and factors.
plot.ts(plot.type="multiple")
now makes use of *.lab
and
*.axis
graphical parameters (wish of PR#13134 and PR#13135).
Classes can be exported from a name space using the NAMESPACE
file
directive which has the same syntax as .
strftime()
now converts its first argument with as.POSIXlt()
and
so is no longer an alias for format.POSIXLt
.
body<-()
now treats list values consistently with other types:
they no longer need to be wrapped in a list()
call.
option("pdfbrowser")
is now set on Windows as well as on
Unix-alikes.
object.size()
now returns an object of class and has a print()
method.
[col/row]Sums()
, *Means()
now have an additional argument, so
that they can more easily be turned into generic functions.
Package tools contains
dependsOnPkgs()
to compute reverse dependencies.
Strict type checking is now turned on: this catches more internal corruptions, and some badly written contributed code.
There are new functions in package
tcltk,
tk_choose.files()
, tk_choose.dir()
and tk_messageBox()
,
analogues of functions available on Windows (the last is an analogue
of winDialog).
Sys.glob()
now does tilde expansion on all platforms.
read.table()
and friends gain a fileEncoding
argument to make
re-encoding of input just a little bit simpler.
grep()
gains an invert
argument mimicking .
strwrap()
now allows a separate prefix for the first line.
grep()
has a more efficient sibling grepl()
that returns a
logical vector.
xfig()
has new arguments defaultFont
and textSpecial
contributed by Sebastian Fischmeister.
parse()
and parse_Rd()
now point to syntax errors in the
reported error context, and include the filename and line and column
numbers so smart text editors can jump to the error location.
str(<1d-array>)
now writes "[1:n(1d)]"
instead of the previous
less clear "[, 1:n]"
.
New function testInstalledPackage()
in package
tools allows the
examples (and if they were installed) any package-specific tests to
be run on an installed package.
testInstalledPackages()
can run all the examples and tests in the
standard and/or recommended packages. Also testInstalledBasic()
can run the basic tests (if installed).
file.copy()
now has a recursive
argument.
Errors in setOldClass()
will cause a previous definition to be
restored.
Ambiguities in class inheritance and method selection resulting from
duplicates in superclasses are now resolved by requiring (if
possible) consistency with all the superclass inheritance. The rules
for method selection have been revised to take advantage of the
improved ordering. See ?Methods
and the reference there related to
inheritance.
New function unzip()
in package
utils to expand or
list zip archives.
Replacement functions for class()
and oldClass()
will unset the
S4 bit when the replacement can’t be an S4 object; oldClass()
will
return the S3 class for S4 objects with slot .S3Class
.
clip()
takes extra steps to avoid the next graphics call resetting
the clip region.
New function sample.int()
to provide documented access to the
internal part of sample()
(sampling from seq_len(n)
).
New version of function withVisible()
for better handling of cases
like withVisible(eval.parent(...))
. Moved to package
base with a view to
replace .Internal(eval.with.vis)
in source()
later.
showClass()
which is also used to auto-print class definitions,
now mentions the package where the class comes from, if there is
one.
simulate(obj)
now also works for "glm"
objects and for weighted
fits, thanks in part to contributions from Ben Bolker and Heather
Turner. There is now a means to extend the methods available for
"glm"
objects, as glm
families can have an optional simulate
component.
S4 classes that inherit from any of the "structure"
classes or
from "vector"
will turn on methods for all the group of functions
when the package containing the classes is loaded. See
class?structure
.
A mechanism now allows S4 classes to inherit from object types
"environment"
, "externalptr"
and symbol ("name"
). See
?setClass
.
demo()
gains echo
and ask
arguments, with defaults similar to
example()
.
library()
no longer checks for the packages merged during the
re-organization of 1.9.0.
New function poisson.test()
in package
stats for exact test
of rates and rate ratios.
New function isdebugged()
indicates whether its argument has the
debug flag set or not.
ls.str()
[via print
method] now also works when some objects
in the environment are missing()
.
Subsetting S4-objects (without an explicit "["
method) no longer
preserves the class in cases like setClass("C", contains="list")
;
This reverts a “bug fix” activated in R 2.8.0.
.packages()
and .find.packages()
no longer check the package
info for installed packages with dumped metadata, since this was
checked when the package was installed. .packages()
only considers
such packages to be validly installed (any others were installed in
a long-obsolete version of R). Both changes speed up searches in
libraries of thousands of packages.
boxplot()
uses butt line endings for its median line (suggestion
of Uwe Ligges, PR#13553).
S4 objects passed to a non-default S3 method will be converted to a
valid S3 object with the S3 class. See the section on inheriting
from non-S4 classes in ?Classes
.
A new class "nonStructure"
has been defined; classes that extend a
vector class but that should lose their slots under or functions
should extend this class. See class?nonStructure
.
axis.POSIXct()
now plots in the timezone marked for its inputs (if
any) rather than in the local time. The latter was a deliberate
choice, but is easy to select by removing the tzone
attribute.
(Suggestion of Dan Kelley.)
A new function classesToAM()
returns an adjacency matrix
representing the inheritance of the classes specified. Allows better
human examination of the patterns, e.g. by using the matrix as input
to one of the graph packages (see the documentation).
X11options(antialias = "none")
now works, for consistency with
X11()
.
sprintf()
now allows zero-length arguments (with a zero-length
result). (Suggestion of Bill Dunlap.)
unlink()
is now able to remove broken symbolic links on
Unix-alikes.
New selectSuperClasses()
utility in package
methods.
HoltWinters()
now allows parameters alpha
and beta
to be fixed
at 0 and hence beta = FALSE
and gamma = FALSE
are used to
specify restricted models.
A new function smoothScatter()
has been added to package
graphics. It is
appropriate for very dense scatter plots and uses density estimation
and color to reflect density of plotting.
allGenerics()
is defunct.
Use of is defunct and gives an error.
The compatibility define for graphics structure in
GraphicsDevice.h
has been removed.
Support for versioned installs ( and
install.packages(installWithVers = TRUE)
) has been removed.
Packages installed with versioned names will be ignored.
The numeric and power(0.5)
forms of argument to make.link()
which were deprecated in 2.4.0 are now defunct: use power()
directly.
Conversion to and by is now defunct.
Support for is now defunct (and package gnomeGUI has been withdrawn as it used a long-obsolete version of GNOME).
on Windows will call the first target (not ) in Makevars[.win]
in
future versions: so make the first target if you have any.
now also uses a Makevars[.win]
file for cleaning up src/
.
and are now able to cope with Cyrillic characters in UTF-8 if
environment variable _R_CYRILLIC_TEX_
is set to a non-empty value
and the LaTeX system has suitable fonts (thanks to a hint from
Alexey Shipunov).
New function rtags()
in package
utils that provides
etags-like indexing capabilities for R code files.
New front-end script R CMD rtags
provides an interface to the
rtags()
function (see for details).
New environment variable R_TEXI2DVICMD
to hold the path (if any)
to texi2dvi found at configure time: this now provides the default
to option("texi2dvi")
.
massage-Examples.pl
has been replaced by the R function
tools:::massageExamples()
.
now uses remove.packages()
and hence removes all members of a
bundle.
is now an R script and has a new option aka to show what commands would be run. The same code is used on Unix and Windows.
has new options and to set the corresponding fields in HTML conversion.
runs the package tests with a custom startup file, currently containing .
Those tests are run by an R script: using a tests/Makefile
(undocumented) no longer works.
now knows about and , for use in configure files.
has a new option to suppress printing out the session timing.
can now work on an installed package.
no longer loads package tcltk when checking for code problems, so more problems may be reported.
For on Windows the default target only makes the DLL, and no longer call targets and .
Rd
files have an optional \Rdversion{}
section, which if missing
defaults to 1.0. There is support for version 1.1, a slightly
modified version with the following changes:
- The warnings for \code{}
inside \examples
are suppressed.
- Whitespace between arguments in \item
and \section
is
accepted without a warning (see below).
- $
is treated literally in text, even for latex conversions.
- \
is only an escape before % { } \
.
- \R
, \dots
and \ldots
can be followed by {}
, and it is
recommended that they are when not followed by whitespace.
- The obsolete interpretation of \Alpha
etc is no longer done.
Rd
conversion now handles ^ ~ < > |
correctly in non-code
environments (such as \samp
), and # and _ even in latex
conversion (but $
still needs to be escaped in version 1.0).
Whitespace between first and second arguments is now accepted for
\item
and \section
, e.g. \item{foo}
some value. Previously
arguments after whitespace were silently ignored, and a warning is
given for version 1.0 files.
The Rd
files created by prompt()
and friends are declared to be
version 1.1.
\alias
now supports the escaping of {
as well as of %
, and
this is recommended.
parse_Rd()
, an experimental parser for Rd
files, and Rd2txt()
,
Rd2HTML()
, Rd2latex()
and Rd2ex()
, even more experimental
converters, have been added to package
tools.
runs the package’s Rd
files through parse_Rd()
for a stricter
syntax check. This can be suppressed by setting _R_CHECK_RD_PARSE_
to FALSE
.
Added markup \verb
, which displays like \code
, but parses as
verbatim text. Currently only supported by parse_Rd()
and
Rd2HTML()
.
The shell used by the R
script and other shell scripts intended to
be run directly can be specified at installation time by setting the
(precious) configure variable R_SHELL
.
libtool has been updated to 2.2.6a.
is now the default: this means that ICU will be used for collation on Mac OS \(>=\) 10.4.
can be used to install the test files, to allow an installed version
of R to be tested – see the R-admin
manual. This is also
supported by the function testInstalledPackages()
in package
tools.
using a parallel make should now work.
now always re-makes and re-runs the package examples, which are now collated in the locale’s order (and not ASCII order).
configure will now set the default optimization level for gfortran on x86_64 Linux to as has caused problems with gfortran 4.3.x.
install.packages()
is able to infer that repos=NULL
was intended
from the extension on the file name specified as pkgs
.
On Mac OS X it now supports local binary packages with .tar.gz
extension. Nonetheless .tgz
remains the preferred extension and is
expected in repositories.
It now checks \(>=\) version dependencies for dependent packages, and so will install a newer version of a dependency if needed and available on the repositories.
The library being installed into is considered when looking for
installed packages if it is not already part of .libPaths()
(as
already does).
It has a new argument Ncpus
to support parallel installs of source
packages.
HTML links will be resolved first to the standard packages: this
avoids other installed packages diverting help on e.g. qr()
and
plot()
to themselves. The HTML files are only "touched" if they
have changed.
A check is done that the R files can be parsed: this both prevents a broken package without lazy-loading from being installed and gives better diagnostics.
install.packages()
gains a configure.vars
argument, and both
this and configure.args
get their defaults from options()
.
There is a unified R script for on both Unix-alike and Windows that takes option names used by either in the past.
It adds to disable building other than the main sub-architecture, and allows multiple instances of and (which will be concatenated).
New option will install any package-specific tests.
Times in the and fields are now recorded in UTC, and in most cases in ISO 8601 format.
asCharacterFactor
, converts from factors to
character vectors.The postscript()
output for setting text is faster and smaller.
Subsetting a data frame with duplicate column names without
selecting columns (e.g. z[i,]
) no longer makes the column names
unique. This was never documented, but some packages have assumed
it.
data.frame()
no longer ignores row names on objects if the first
name is empty. (PR#13230: this has been the behaviour for a long
time, but apparently undocumented.)
deparse(control="S_compatible")
now never uses backticks.
X-spline drawing is improved for cases where the control points are located well off the edges of the device.
The symptom of this problem is the error "reached MAXNUMPTS"
.
exists()
with will no longer run an active binding’s function.
format(c(1 + 2i, NA))
no longer has extraneous space in " NA"
.
mood.test()
could fail in 2.8.x on large samples because of
integer overflow.
heatmap()
without a dendrogram could fail (PR#13512).
Checks for missing values will no longer occasionally result in an infinite loop or stack overflow error, depending on the compiler. Active bindings are now always considered to be non-missing.
Rd
conversion was not accepting \p
(as in \CRANpkg
) or (when
using Perl 5.10.x) \k
(as in \kbd
) in any preamble text in a
section, since those are nowadays interpreted by Perl (PR#13575).
if(as.raw(1)) TRUE
now works as expected (PR#13630). Also,
c(as.raw(12), TRUE)
or c(raw(3), pi)
do.
duplicated(<data frame>, incomparables = NA)
now gives the
intended error message (PR#13632).
Name handling of as.data.frame()
has been sanitized somewhat.
Evaluating an assignment expression with a string on the left hand side no longer destructively changes the string to a symbol in the expression.
Matrix, tools, tcltk, utils, base, stats, methods, graphics, gnomeGUI
Econometrics, NumericalMathematics
This article is converted from a Legacy LaTeX article using the texor package. The pdf version is the official version. To report a problem with the html, refer to CONTRIBUTE on the R Journal homepage.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Team, "Changes in R 2.9.0", The R Journal, 2009
BibTeX citation
@article{RJ-2009-1-r-changes, author = {Team, The R Core}, title = {Changes in R 2.9.0}, journal = {The R Journal}, year = {2009}, note = {https://rjournal.github.io/}, volume = {1}, issue = {1}, issn = {2073-4859}, pages = {71-76} }