Open gdevenyi opened 2 years ago
Having not looked into this yet, I wonder whether we still support the rather hackish quote(...(x)) syntax or whether it should just be mincApply(..., mean)
, etc.
We have tried both. The error is identical.
I have reproduced this behaviour with R 3.6.x and develop RMINC which otherwise passes the test suite. However,
pMincApply(gf$jacobians_fixed_2, testFunc, workers = 4, local = TRUE)
works correctly. If there's some other option combination without using quote
which fails unexpectedly, please let me know.
Also, where in the documentation have you found this example? The test suite doesn't test pMincApply with quote
, which I am tempted to consider a deprecated mode anyway (although supporting dplyr function syntax ~ .
etc or even our lenses
package's extended x ~ x + 2
syntax would be nice).
However,
I didn't know to try testFunc
bare. We were using testfunc(x)
without quote. This works! Hurrah!
Also, where in the documentation have you found this example?
The first entry in examples here, https://rdrr.io/github/Mouse-Imaging-Centre/RMINC/man/mincApply.html
Made some minor updates to the source documentation in 807ffc5886ae, which should be reflected downstream after the next release (when we regenerate the docs).
Sorry to follow up again, we're having new issues with pMincApply and I'm not sure what to do
The goal here is to attempt to solve #298 by writing our own code.
plslmer <- function(x, data) {
mydata = cbind(data,x)
eff = coef(lmer(x ~time_month + (time_month||Id), data = mydata,REML = T, lmerControl(optimizer ="Nelder_Mead")))
return(c(eff$Id$`(Intercept)`,eff$Id$time_month))
}
testrun <- pMincApply(data$jacobians, plslmer, workers = 4
, local = T, tinyMask = T, global=c("data","plslmer"))
But we get this:
I think pMincApply expects a single-argument function; assuming your handling of the coefficients is correct, what about
plslmer <- function (data) function (x) { ... }
testrun <- pMincApply(data$jacobians, plslmer(data), ...)
although I'm not sure exactly how this interacts with global
but maybe for local = T
it doesn't matter.
Sadly your suggestion produces the same error.
So in order, I would try: (i) look for more informative errors in the log files; (ii) try mincApply instead to see if this fails in the same way; (iii) create a reprex we can look at.
I will try and look at this tonight/tomorrow. A reprex would be handy, but if I think there's enough in this thread to get a handle on what you're trying to do even without one.
I've tried to generate a reproducer using the test data and been unable to. Looking into how to provide a pared down dataset.