I would like to create a result-vector of a sub-group of functions.
This is a simplified example of what I mean:
# create example functions
set.seed(999)
create_fun <- function(start, len) {
res <- function() {
seq(from = start, length.out = len)
}
res
}
for (i in 1:4) {
eval(parse(text = paste0("f", i, "<-create_fun(", sample(1:10, 1), ",", sample(2:5, 1), ")")))
# btw is it possible to use something like assign instead of eval-parse?
}
# static version of what I want
c(f1(), f3(), f4())
# 4 5 6 7 8 9 7 8
# dynamic version of what I want
x <- c(f1 = TRUE, f2 = FALSE, f3 = TRUE, f4 = TRUE) # I'd like to start with a vector of function-names to use
# .. but now what?
How to do this properly?