My reason for setting stringsAsFactors = FALSE is more
that I really dislike having R convert what I think
are character variables to factors when I import data.
I suspect that it takes quite a few new users by
surprise that what they had intended to be a character
variable has become a factor.
Hi all,
If we, the R community, are endeavoring to make R user friendly
(gasp!), I think that one of the first places to start would be in
setting stringsAsFactors = FALSE. Several times I've run into
instances of folks decrying R's rediculous usage of memory in
reading data, only to come to find
Of Matthew Keller
Sent: Tuesday, August 14, 2007 12:48 PM
To: John Kane
Cc: Falk Lieder; r-help@stat.math.ethz.ch
Subject: Re: [R] Convert factor to numeric vector of labels
Hi all,
If we, the R community, are endeavoring to make R user friendly
(gasp!), I think that one of the first places to start
I think that you grossly underestimate the frequency of use of factors
in R, not to mention that factors are stored more efficiently than
character vectors.
All modeling functions depend upon them. Most testing, grouping and
plotting functions (base R and Lattice) either use them directly as
This is one of R's rather _endearing_ little
idiosyncrasies. I ran into it a while ago.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/98090.html
For some reason, possibly historical, the option
stringAsFactors is set to TRUE.
As Prof Ripley says FAQ 7.10 will tell you
Hi,
I have imported a data file to R. Unfortunately R has interpreted some
numeric variables as factors. Therefore I want to reconvert these to numeric
vectors whose values are the factor levels' labels. I tried
as.numeric(factor),
but it returns a vector of factor levels (i.e. 1,2,3,...) instead
See the FAQ Q7.10 (and please study the posting guide)
On Sun, 12 Aug 2007, Falk Lieder wrote:
Hi,
I have imported a data file to R. Unfortunately R has interpreted some
numeric variables as factors. Therefore I want to reconvert these to numeric
vectors whose values are the factor levels'
See the FAQ, Q7.12.
On Wed, 4 Jun 2003, Philipp Pagel wrote:
Every once in a while I need to convert a factor to a vector of numeric
values. as.numeric(myfactor) of course returns a nice numeric vector of
the indexes of the levels which is usually not what I had in mind:
...
It's done that
On Wed, 4 Jun 2003, Prof Brian Ripley wrote:
See the FAQ, Q7.12.
On Wed, 4 Jun 2003, Philipp Pagel wrote:
Every once in a while I need to convert a factor to a vector of numeric
values. as.numeric(myfactor) of course returns a nice numeric vector of
the indexes of the levels which is
Hi R-experts!
Every once in a while I need to convert a factor to a vector of numeric
values. as.numeric(myfactor) of course returns a nice numeric vector of
the indexes of the levels which is usually not what I had in mind:
v - c(25, 3.78, 16.5, 37, 109)
f - factor(v)
f
[1] 25
10 matches
Mail list logo