Description Usage Arguments Value Author(s) Examples
If you've ever wanted to give someone a single function from within a package full of code, then you've probably forgotten a few other code functions & gone back & forth. Given a single function, this method will determine all the code dependencies. It only searches within a limited set of packages, such as those that you may have written yourself & not published yet. It will also tell you which CRAN/BioC packages need to be installed, but will ignore those packages which are automatically loaded at startup.
1 2 3 | get.function.dependencies2file(fun, file,
packages = c(list.my.packages(src.root = getOption("src.root")), ".GlobalEnv"),
src.files = NULL, verbose = FALSE)
|
fun |
either a function name, of the function's code |
file |
path to a file to write to |
packages |
vector of packages to search for dependencies in (ie packages that you probably wrote) |
src.files |
optional vector of R sources files to also search within. These have higher priority than code within packages. |
verbose |
logical: verbose output? |
nothing. writes a file containing source code.
Mark Cowley, 2011-04-07
1 2 3 4 5 6 7 | ## Not run:
f <- tempfile()
get.function.dependencies2file(fun=edit.src.file, file=f)
get.function.dependencies2file(fun=edit.src.file, file=f, src.files=NULL, verbose=TRUE)
unlink(f)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.