If a package is not installed on the computer/server intended to run a final script, this function can take the script and export it together with all objects (functions, methods et cetera) from specified R packages. It might thereafter be possible to transfer the script and to run it even if all packages are not installed by the host.

exportr(
  script = NULL,
  packages,
  recursive = TRUE,
  outfile = "./generated_r_script.R",
  force = FALSE
)

Arguments

script

connection with script (file) to append to function definitions

packages

name of packages (as character) to be explicitly included.

recursive

argument passed to package_dependencies

outfile

filename for dump file

force

this function works only in interactive mode by default but output can be forced by this argument set to TRUE

Value

nothing (function called for its side effects)

Details

Some packages use external dependencies and/or compiled code. This is not handled by the function. Hence, there is no guarantee that the script will actually work!