Displaying 1 result from an estimated 1 matches for "onefig2".
2012 Oct 30
1
print and execute functions in a package namespace
...function(fig) {
cat("Figure:") # how to get name of fig function?
print(fig)
fig()
}
lapply(list(fig1, fig2, fig3), onefig)
But I need to work with the names of the figure functions instead,
something like
figlist <- paste0("fig", 1:3)
# using figure name
onefig2 <- function(fig) {
cat("Figure:", fig, "\n")
print(body(fig))
eval(parse((paste0(fig,'()')))) # doesn't work
}
As well, I need to be able to find all functions in the package
namespace matching a pattern.
Can someone help?
--
Michael Friendly...