Displaying 1 result from an estimated 1 matches for "onefig".
Did you mean:
onefig2
2012 Oct 30
1
print and execute functions in a package namespace
...ig2 <- function() plot(10:1)
fig3 <- function() {y<-sample(1:10,10); plot(y); y}
I'd like to produce a document (PDF or HTML) containing the listing of
each function and its output,
using knittr.
I can execute a list of figures using something like
# print and run a figure function
onefig <- 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...