RobinHankin / disordR

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

diff #43

Closed RobinHankin closed 1 year ago

RobinHankin commented 1 year ago

diff() should fail for a disord object but:

> (a <- rdis())
A disord object with hash 4709b30137f7d8ac6460092e0979ed752ede37da and elements
[1] 6 4 1 8 7 2 9 3 5
(in some order)
> diff(a)
[1] -2 -3  7 -1 -5  7 -6  2
attr(,"class")
[1] "disord"
attr(,"class")attr(,"package")
[1] "disordR"
> 
RobinHankin commented 1 year ago

Easy to fix:

> setMethod("diff","disord",function(x){stop("cannot take the diff() of a disord object")})
> diff(rdis())
Error in .local(x, ...) : cannot take the diff() of a disord object