Re: [Rd] ftable.formula

From: Timothy Bates <timothy.c.bates_at_gmail.com>
Date: Thu, 26 Jan 2012 23:17:25 +0000

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
Admit    Gender                             
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)

t

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:
>
> data(UCBAdmissions)
> 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.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 26 Jan 2012 - 23:19:41 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jan 2012 - 09:50:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive