RobinHankin / disordR

https://robinhankin.github.io/disordR/
1 stars 0 forks source link

extraction bug #19

Closed RobinHankin closed 3 years ago

RobinHankin commented 3 years ago

Look:

> a <- disord(c(1,2,3,3))
> a[a==3]
[1] 3 3
> 

I would expect the last line to return a disord object, not a vector.

RobinHankin commented 3 years ago

It's not a bug as such, but an infelicity. To return a disord consistently one should set drop=TRUE. But the error was very unexpected. The context was:

> a <- disord(c(1,2,3,3))
> a[a==3] <- a[a==3] + 6
Error in .local(x, i, j = j, ..., value) : length(value) == 1 is not TRUE
>