Hi
I understand that map()
takes a data frame and iterates a single function over it's every object. but what if instead of a single function, I wanted to iterate a list of functions over every object of a data frame?
the nearest thing I found in "R for Data science" is invoke_map()
invoke_map()
passes a list of arguments to a list of cognate functions.
but my problem is that while I can pass a single vector to a list of functions using invoke_map()
, I can't pass a data frame to it.
for example lets say I want to pass this data frame:
df <- tibble(
a = rnorm(10),
b = rnorm(10),
c = rnorm(10),
d = rnorm(10)
)
to this list of functions:
f <- c("mean", "median", "IQR")
I can do it separately for each object:
invoke_map(f, x = df$a)
but if I'm supposed to do it for each object of data frames, it'll quickly become tedious.
So is there any function in tidyverse that allows you to pass a data frame(or even better, a list of data frames) to a list of functions?