If an extraction operation returns a dropped value, the replacement methods can incorrectly return a meaningless value:
> a <- disord(c(1,1,-1,-1))
> a
A disord object with hash bda785a4f305ab7cff0cd25e77c7f76e4cbb6bbb and elements
[1] 1 1 -1 -1
(in some order)
> a[a>0] <- 5:6
> a
A disord object with hash bda785a4f305ab7cff0cd25e77c7f76e4cbb6bbb and elements
[1] 5 6 -1 -1
(in some order)
>
Above we see a[a>0] <- 5:6 returning a value, but the idiom should return an error.
If an extraction operation returns a dropped value, the replacement methods can incorrectly return a meaningless value:
Above we see
a[a>0] <- 5:6
returning a value, but the idiom should return an error.This was causing problems in the
freealg
package:https://github.com/RobinHankin/freealg/issues/31