View source: R/att_from_rscripts.R
| att_from_rscript | R Documentation |
:: and library/requires in one scriptLook for functions called with :: and library/requires in one script
att_from_rscript(path, encoding = getOption("encoding"))
path |
path to R script file |
encoding |
Encoding passed to |
Uses the R parser to walk the syntax tree so that occurrences of pkg::fun
or library()/require()/requireNamespace()/loadNamespace()/use()/getFromNamespace()
inside string literals or comments are ignored.
Named arguments such as library(package = "pkg") are supported, as are
fully-qualified forms like base::library(pkg) or
methods::getFromNamespace(fn, "pkg").
Introspection helpers such as packageVersion(), getNamespace(),
asNamespace(), and attachNamespace() are not treated as dependency
introducers, because they are commonly used for version or feature checks
on packages that may or may not be required at runtime.
If the file cannot be parsed as valid R (syntax error, corrupt encoding,
etc.), the function falls back to a regex-based detector and emits a
warning() naming the file so users can investigate.
a vector
dummypackage <- system.file("dummypackage",package = "attachment")
# browseURL(dummypackage)
att_from_rscript(path = file.path(dummypackage,"R","my_mean.R"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.