Running examples in ‘mvbutils-Ex.R’ failed
The error most likely occurred in:

> ### Name: numvbderiv_parallel
> ### Title: Economy numerical derivatives
> ### Aliases: numvbderiv_parallel numvbderiv
> ### Keywords: misc
> 
> ### ** Examples
> 
> # Complex numbers are OK:
> numvbderiv( function( x) x*x, complex( real=1, imaginary=3))
[1] 2+6i
> # [1] 2+6i
> # Parallel example...  the whole point is to show speed and generality
> # Works fine on my machine
> # But if testing under CRAN, which I normally never do,
> # then CRAN's ludicrous 2-core limit, and deliberate inability to
> # check CRANality (or even number of cores _allowed_) while running,
> # makes this completely ridiculous
> # Not for the first time
> # I have used the function 'get_ncores_CRANal' to try to get round this...
> if( require( 'doParallel')){ # auto loads foreach, iterators, parallel thx2 "Depends"
+   ncores <- detectCores( logical=FALSE)
+   scatn( '%i cores really found', ncores)
+   if( ncores > 2 ){ # pointless otherwise
+     # Need a slowish example. 1e5 is too small; 1e7 better,
+     # ... but hard on auto builders eg R-universe
+     BIGGOVAL <- 1e5
+     slowfun <- function( pars, BIGGO)
+       sum( sqr( 1+1/outer( seq_len( BIGGO), pars)))
+     parstart <- rep( 2, 8)
+     system.time(
+       dscalar <- numvbderiv( slowfun, parstart,
+           BIGGO=BIGGOVAL # named extra param (part of ...)
+         )
+     ) # scalar
+     # Make "doPar back end". I do not know what I am doing ...
+     # NB I like to leave some cores spare, hence "-1"--
+     # superstition, really
+     ncores_target <- min( ncores-1, length( parstart))
+     # Anti CRANky: ignore on your own machine:
+     # ncores_target should just work
+     ncores_avail <- get_ncores_CRANal( ncores_target)
+     scatn( 'Using %i cores eg cozza CRAN', ncores_avail)
+     CLUSTO <- makeCluster( ncores_avail)
+     registerDoParallel( CLUSTO, ncores_avail)
+     # Next bit ensures slaves can find packages... sigh.
+     # Necessary _here_ coz example, but you may not need it
+     # clusterCall does not work properly :/, so the "obvious" fails:
+     # clusterCall( CLUSTO, .libPaths, .libPaths())
+     # Instead, we are forced into this nonsense:
+     print( # for debuggery with as-CRAN
+     eval( substitute(
+         clusterEvalQ( CLUSTO, .libPaths( lb)),
+         list( lb=.libPaths())))
+     )
+     # Need 'mvbutils::sqr', hence '.packages' arg
+     scatn( 'Starting parallel time test')
+     print( system.time(
+       dpara <- numvbderiv_parallel( slowfun, parstart,
+           BIGGO=BIGGOVAL, # named extra parameter
+           FOREACH_ARGS=list( .packages= 'mvbutils')
+         )
+       )
+     )
+     scatn( 'Done')
+     print( rbind( dscalar, dpara))
+     # To refer to other data (ie beside params)
+     # best practice is to put it into function's environment
+     # (generally true, not just for numvbderiv)
+     e <- new.env()
+     e$paroffset <- c( 6, -3)
+     fun2 <- function( pars) { # not a speed test, can be smaller
+         sum( sqr( 1+1/outer( 1:1e3, pars+paroffset)))
+       }
+     environment( fun2) <- e
+     scatn( 'Scalar, using extra data via environment')
+     print( numvbderiv( fun2, parstart))
+     # Parallel version should still work, coz function's environment
+     # is also passed to slaves
+     scatn( 'Trying parallel version...')
+     print( try({
+       numvbderiv_parallel( fun2, parstart,
+           FOREACH_ARGS=list( .packages= 'mvbutils')
+         )
+       })
+     )
+     # Sometimes you do need to explicitly export stuff to the slave processes
+     # Here's a version that will get paroffset from datenv
+     # datenv must exist...
+     alt_fun2 <- function( pars){
+       environment( fun2) <- list2env( datenv)
+       fun2( pars)
+     }
+     scatn( 'With explicit data (in parallel)')
+     datenv <- as.list( e)
+     print( numvbderiv_parallel( alt_fun2, parstart,
+         FOREACH_ARGS=list(
+           .packages= 'mvbutils',
+           .export= cq( datenv, fun2) # stuff that alt_fun2 refers to
+           )
+       )
+     )
+     # Always tidy up your clusters once you have finished playing
+     stopImplicitCluster()
+     stopCluster( CLUSTO)
+     rm( CLUSTO)
+   } # if ncores>2
+ } # parallel
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
6 cores really found
Error in stopCluster(CLUSTO) : CRANtidote
Calls: get_ncores_CRANal -> stopCluster
Execution halted