[Rd] Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Tue Apr 30 12:51:30 CEST 2013
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
More information about the R-devel
mailing list