0

I'm trying to substitute lapply function with mclapply on a shiny application, with the trace function.

I'm trying to narrow the trace to the used package's namespace, but it is not working.

Most errors are problems of inputs in lapply, either by embedded function in lapply or more than one function as input.

EXAMPLE of Output:

Loading required package: shiny
Tracing function "lapply" in package "base"
Tracing lapply(paths, function(p) { .... on entry 
Error in lapply(X, FUN, ...) : argument "FUN" is missing, with no default
Tracing lapply(keys, get, missing) on entry 
Error in lapply(X, FUN, ...) : argument "FUN" is missing, with no default
Tracing lapply(x, f) on entry 
Tracing lapply(x, f) on entry 

Here is how I'm calling trace function:

trace(base::lapply, tracer=substitute(parallel::mclapply(match.call())),where=namespace.vec)

and namespace.vec variable has the used packages namespaces used in the application.

Thank you very much in advance.

  • 1
    `Tracing function "lapply" in package "base"` That is a supremely bad idea. You should always assume that your code somehow uses `lapply` internally and that you would create nested parallelization (which can be very problematic when not controlled carefully) by substituting it with `mclapply`. – Roland Sep 23 '20 at 06:35
  • Thank you for your comment. I know this is an unorthodox way of doing it but do you happen to know or be able to suggest other options? Best – Rui Sarmento Sep 23 '20 at 09:32

0 Answers0