timothy.c.bates at gmail.com
Fri Jan 27 00:17:25 CET 2012
At least this is correct :-)
ftable(UCBAdmissions, Dept ~ Gender + Admit)
But yes: the formula
ftable(UCBAdmissions, Gender + Admit ~ Dept)
should see "The left and right hand side of formula specify the column and row variables, respectively"
# demo of right-hand side bug
ftable(UCBAdmissions, Gender + Admit ~ Dept) # "Dept" should be in the rows...
Dept A B C D E F
Admitted Male 512 353 120 138 53 22
Female 89 17 202 131 94 24
Rejected Male 313 207 205 279 138 351
Female 19 8 391 244 299 317
Also, the example appears not to be a correct use of the "." shortcut.
x <- ftable(Survived ~ ., data = Titanic)
# Error in ftable.formula(Survived ~ ., data = Titanic) :
# cannot use dots in formula with given data
Also "Survived" should be "survived"
And in this example, all vars should be lower-case
ftable(Sex ~ Class + Age, data = x)
On 26 Jan 2012, at 22:31, Brett Presnell wrote:
> From reading the documentation for ftable.formula, I expected that the
> following two calls to ftable would produce the same results:
> ftable(UCBAdmissions, row.vars = "Dept", col.vars = c("Gender", "Admit"))
> ftable(UCBAdmissions, Gender + Admit ~ Dept)
> Is this a bug or the intended behavior? I prefer the formula interface,
> so I would be happiest if the output was the same for the two calls.
> However, if this is the intended behavior, then I think that the
> documentation should be clearer on this point.
More information about the R-devel