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

Duncan Murdoch murdoch.duncan at gmail.com
Tue Apr 30 13:03:50 CEST 2013


On 13-04-30 6:51 AM, Barry Rowlingson wrote:
> 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!!!"

Yes :-).

I will fix it.

Duncan Murdoch



More information about the R-devel mailing list