funInCode | R Documentation |
Report whether a function name is used in some code. Only returns TRUE if it is followed by "(" or included as pack::fun
funInCode(funname, code)
funname |
Function name (character string) |
code |
Code (character string) |
Berry Boessenkool, berry-b@gmx.de, Aug 2017
https://stackoverflow.com/questions/45691254
if(FALSE){ # not run, since funInCode is no longer exported
code <- "mean(pi); head(data.frame(A=1:5)); data_frame(7:9); do.call(base::print, list(pi))"
funs <- c("mean", "head", "head.data.frame", "data.frame", "frame", "data_frame", "base::print")
data.frame(isfound=sapply(funs, funInCode, code=code),
shouldbefound=c(TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE))
funInCode("ABC::pack.dep", "ABC::pack_dep(A)")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.