RobinHankin / disordR

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

for() loops #41

Closed RobinHankin closed 1 year ago

RobinHankin commented 1 year ago

Look:

> x <- disord(c(4,2,1,2))
> x
A disord object with hash 6c08f4289697119188dfd166d674114d8b15a8fe and elements
[1] 4 2 1 2
(in some order)
> for(i in x){print(i)}
[1] 4
[1] 2
[1] 1
[1] 2
> 

See that the for() loop imposes an ordering on x, as it identifies "4" as the first element, "2" as the second, and so on. This is equivalent to using elements(). I don't think this is a bug as such but it should be documented.