This is very difficult to answer given the vagueness of the question, but I’ll make a reproducible example of what I think you’re asking and will give a solution.
Say I have a function that returns a data frame:
MyFun <- function(x)randu[1:x,]
And I have a data frame df
that will act an input to the function.
# a b
# 1 1 21
# 2 2 22
# 3 3 23
# 4 4 24
# 5 5 25
# 6 6 26
# 7 7 27
# 8 8 28
# 9 9 29
# 10 10 30
From your question, it looks like only one column will be used as input. So, I apply the function to each row of this data frame using lapply
then I bind the results together using do.call
and rbind
like this:
do.call(rbind, lapply(df$a, MyFun))
1
solved efficient rbind alternative with applied function