Skip to content
Prev 36804 / 63424 Next

Indexing bug?

On Wed, May 26, 2010 at 3:27 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
I would say it gives

results[as.numeric(x)]

and it's not clear if that is less "expected". E.g., what happens if
results has no names? results[as.numeric(x)] would still work, but not
results[as.character(x)].

Factors have a dual nature (character labels vs numeric codes), and
when forced to choose, I think it's reasonable to choose the solution
which works more generally.

-Deepayan