[Rd] Changing the generic of as.data.frame
Bill Dunlap
bill at insightful.com
Mon May 22 17:50:34 CEST 2006
On Mon, 22 May 2006, Prof Brian Ripley wrote:
> The other motivation was to allow the option to not convert character
> vectors to factors, which needed an additional argument to
> as.data.frame.character. So data.frame now has an argument 'charToFactor'
> controlled by a global option (which also controls the default of as.is in
> read.table). More experience will be needed as to whether it is safe to
> work with the global option set to FALSE, so that aspect should be
> regarded as experimental until 2.4.0 is released or it is withdrawn.
Splus's data.frame() and as.data.frame() have had the 'stringsAsFactors'
argument to data.frame and as.data.frame since version 6.0 (2001). Their
default values come from options("stringsAsFactors"). read.table() and
a few other data.frame-oriented functions have the same argument.
It looks like stringsAsFactors has the same functionality as your
new charToFactor. Would it be feasible to change its name to stringsAsFactors?
Splus> help(data.frame)
Construct a Data Frame Object
USAGE:
data.frame(..., row.names, check.rows=F, check.names=T,
na.strings="NA", dup.row.names=F, stringsAsFactors=<<see below>>)
data.frameAux(x, ...)
as.data.frame(x, row.names=NULL, stringsAsFactors=<<see below>>, ...)
is.data.frame(x)
...
stringsAsFactors
a logical flag; if TRUE then convert character arguments
to factors whose levels are the unique strings in the
argument. This may save time and space if there a many
repeated values in the strings and may make the
statistical modelling functions easier to use. The
default is TRUE, unless one sets options(stringsAsFactors=FALSE).
...
----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146
"All statements in this message represent the opinions of the author and do
not necessarily reflect Insightful Corporation policy or position."
More information about the R-devel
mailing list