From b.rowlingson at lancaster.ac.uk  Tue Apr 30 12:51:30 2013
From: b.rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Tue, 30 Apr 2013 11:51:30 +0100
Subject: [Rd] 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>
References: <1367307525.65406.YahooMailClassic@web125103.mail.ne1.yahoo.com>
	<eba54a80f57a48799228f9b2f8798db4@EX-0-HT0.lancs.local>
Message-ID: <CANVKczOhr5iv4=24JD93F=kF2Ze4zgN1EGMtabmgSo=o5B4T8w@mail.gmail.com>

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



[Rd] Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
Barry Rowlingson