Message-ID: <CANVKczOhr5iv4=24JD93F=kF2Ze4zgN1EGMtabmgSo=o5B4T8w@mail.gmail.com>
Date: 2013-04-30T10:51:30Z
From: Barry Rowlingson
Subject: Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
In-Reply-To: <eba54a80f57a48799228f9b2f8798db4@EX-0-HT0.lancs.local>
On Tue, Apr 30, 2013 at 10:49 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> So it looks like the bug is in the implementation of "/". Either it
> should drop the class, or it should set the object bit.
>
> The difference in printing between auto-printing and explicit printing
> may be worth addressing, but really objects like ratio shouldn't exist,
> so it's not surprising that they behave strangely.
Also happens with *, if LHS is not a scalar:
> c(1,1)*table(x)
x
A B
2 2
attr(,"class")
[1] "table"
> 1*table(x)
x
A B
2 2
- similar with + and -, but not unary + and -.
Nice to see a bug in arithmetic operators that isn't covered by
everyone screaming "FAQ 7.31!!!"
Barry