From ripley at stats.ox.ac.uk  Wed Nov 28 15:29:48 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 28 Nov 2012 14:29:48 +0000
Subject: [Rd] [R] error in plot(table(c('a','a')))
In-Reply-To: <CAAmySGO8Wx05spC+95QAAPjndphmHnAOusKirQ8DQweDKf+9UA@mail.gmail.com>
References: <3cb3bdb5b91966573be20763f50c4f71.squirrel@webmail.xs4all.nl>
	<CAAmySGNQPL-vq5fFpS1YHc7YF2xar_18XhThO_8DQPxPxcS6Aw@mail.gmail.com>
	<50B3FC84.3080400@sapo.pt>
	<CAAmySGO8Wx05spC+95QAAPjndphmHnAOusKirQ8DQweDKf+9UA@mail.gmail.com>
Message-ID: <50B61FDC.2060006@stats.ox.ac.uk>

On 28/11/2012 14:22, R. Michael Weylandt wrote:
> Should I file an issue for this in the bug tracker?

Someone already has. (15118, against R 2.14.0!)

>
> Slighly rearranged discussion with reproducible example follows on below.
>
>> Em 26-11-2012 21:39, R. Michael Weylandt escreveu:
>>>
>>> On Mon, Nov 26, 2012 at 2:41 PM, Ludo Pagie <l.pagie at nki.nl> wrote:
>>>> tbl.char1 <- table(c('a','a'))
>>>> tbl.char2 <- table(c('a','a','b'))
>>>> tbl.int1 <- table(c(1,1))
>>>>
>>>> # error:
>>>> plot(tbl.char1)
>>>>
>>>> # no errors:
>>>> plot(tbl.char2)
>>>> plot(tbl.int1)
>>>>
>>> Confirmed in current R-devel. It seems to arise from plot.table's use
>>> of seq.int(x) when the dimnames of the table are not integers. I'm not
>>> sure if this shouldn't be seq_along(x) instead, but I'm not sure I
>>> totally follow the internal logic, so perhaps someone can offer second
>>> opinion?
>
> On Mon, Nov 26, 2012 at 11:34 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>>   I'd change "when the dimnames of the table are not integers "
>> to not numeric as that's what the code for plot.table tests. And it
>> seems to come from seq.int, since with table value
>> of 2, seq.int produces a vector of length 2 but the table length is 1:
>>
>> seq_along seems to solve the matter.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] [R] error in plot(table(c('a','a')))
Prof Brian Ripley