RobinHankin / disordR

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

sapply() #6

Closed RobinHankin closed 3 years ago

RobinHankin commented 3 years ago

Issue #5 refers. sapply() does not work as desired:

> a <- list(1,1:2,8:4,30)
> sapply(a,length)
[1] 1 2 5 1
> sapply(disord(a),length)
Error in as.list.default(X) : 
  no method for coercing this S4 class to a vector
> 

I want sapply() to return a disord object with elements 1 2 5 1 (in some order).

RobinHankin commented 3 years ago

Now works:

> a <- disord(list(1,1:2,1:3,5:9))
> sapply(a,length)
A disord object with hash 09af40322fd9521f7477cfdbf1e77824a3f9290e and elements
[1] 1 2 3 5
(in some order)
>