role-model / roleR

R package implementing the RoLE model
https://role-model.github.io/roleR
GNU General Public License v3.0
1 stars 2 forks source link

roleExperiment.R `setAs` - attempt to replicate an object of type 'closure' #86

Closed isaacovercast closed 1 year ago

isaacovercast commented 1 year ago

I am pretty sure this is a downstream result of the iterFun implementation.

If I do this as(model, "roleExperiment"), I get this:

Error in rep(p, length(j)): attempt to replicate an object of type 'closure'
Traceback:

1. as(model, "roleExperiment")
2. asMethod(object)
3. lapply(pnames, function(p) {
 .     p <- slot(from@params, p)
 .     if (length(p) > 1) {
 .         p <- c(p[1], p)
 .         return(p[j])
 .     }
 .     else {
 .         return(rep(p, length(j)))
 .     }
 . })
4. FUN(X[[i]], ...)

Looks like this is coming from roleExperiment.R:114. Here if 'p' is a function (like with iterFuns) then the call to rep(p, #) will complain and error out.

diazrenata commented 1 year ago

May be addressed via #77

ajrominger commented 1 year ago

once #77 is merged this will indeed be resolved