[Rd] stringsAsFactors = FALSE
hadley wickham
h.wickham at gmail.com
Mon Nov 17 14:10:10 CET 2008
Hi all,
I love the option to not automatically convert strings into factors,
but there are three places that the current option doesn't work where
I think it should:
options(stringsAsFactors = FALSE)
str(expand.grid(letters))
str(type.convert(letters))
df <- read.fwf(textConnection(paste(letters,collapse="\n")), 1)
str(df)
I think type.convert and read.fwf can be fixed by giving them a
stringsAsFactors argument and then using asis = !stringsAsFactors
(like read.table). The key lines in expand.grid would seem to be
if (!is.factor(x) && is.character(x))
x <- factor(x, levels = unique(x))
but I'm not sure why they are being converted to factors in the first place.
Regards,
Hadley
--
http://had.co.nz/
More information about the R-devel
mailing list