Peter, we are arguing at cross purposes. My point was that if I have specified
options(stringsAsFactors=FALSE) that is a statement to R to NOT DO THIS. Your
argument
in return is that "yes, Therneau said that, but in this case he almost
certainly doesn't
really mean it, so ignore him". Now
My point was that, in a table, the row and columns usually have a well-defined
order. If you convert the table to data frame form, typically in order to fit a
Poisson GLM, you do want to preserve that order, and not have the levels
converted to a locale-dependent alphabetical order in your analy
I have to disagree with both Peter and Martin on this.
The underneath issue is that the automatic conversion of characters to factors
by the
data.frame functions was the single most egregious design blunder in the
Statistical
Models in S book, and we are still living with it. The stringsAsFac
Peter,
Thanks for the response. I have no wish to prolong this and have no axe to
grind. I’m sure you were delighted to see another stringsAsFactors issue.
Perhaps we talking about the conflation of two steps: the first is the language
‘pure' conversion of the table to a data.frame with the cros
Martin Maechler Wrote:
and we should've tried harder to keep things purely functional (R remaining
as closely as possible a "functional language")
This is diverging from the original post.
However, isn't R a multiparadigm programming language (by design)?
[[alternative HTML version delete
> peter dalgaard
> on Thu, 14 Mar 2019 16:18:55 +0100 writes:
> I have no recollection of the original rationale for as.data.frame.table,
but I actually think it is fine as it is:
> The classifying _factors_ of a crosstable should be factors unless very
specifically directe
I have no recollection of the original rationale for as.data.frame.table, but I
actually think it is fine as it is:
The classifying _factors_ of a crosstable should be factors unless very
specifically directed otherwise and that should not depend on the setting of an
option that controls the c
Reporting a possible inconsistency or bug in handling stringsAsFactors in
as.data.frame.table()
Here is a simple test
> options()$stringsAsFactors
[1] TRUE
> x<-c("a","b","c","a","b")
> d<-as.data.frame(table(x))
> d
x Freq
1 a2
2 b2
3 c1
> class(d$x)
[1] "factor"
> d2<-as.data.fra