tempcodefile: Create a temporary file that contains the function definition...

Description Usage Arguments Details Value Author(s) Examples

Description

Create a temporary file that contains the function definition of the argument so that this file can be sourced to re-instantiate the function.

Usage

1

Arguments

fcts

Details

Create a temporary file that contains the function definition of the argument so that this file can be sourced to re-instantiate the function. The temporary file is written to the temporary folder of the current R session.

Value

Returns the path to the file written.

Author(s)

Stefan Böhringer <r-packages@s-boehringer.org>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  # code to be parallelized
  parallel8 = function(e) log(1:e) %*% log(1:e);
  parallel2 = function(e) rep(e, e) %*% 1:e * 1:e;
  parallel1 = function(e) Lapply(rep(e, 15), parallel2);
  parallel0 = function() {
    r = sapply(Lapply(1:50, parallel1),
      function(e)sum(as.vector(unlist(e))));
    r0 = Lapply(1:49, parallel8);
    r
  }

  codeFile = tempcodefile(c(parallel0, parallel1, parallel2, parallel8));
  cat(readFile(codeFile));

parallelize.dynamic documentation built on May 2, 2019, 3:45 a.m.