I have a function that returns a dataframe. I use this function with furrr::future_map2 so that I get a list with several dataframes.
- What I want is the ability to use the
nameinput in the function to name the dataframe so that I can search the return list by name.
example
test <- function(x, name){
require(tidyverse)
z <- data.frame(x+1) %>% stats::setNames(., "a")
return(z)
}
furrr::future_map2(1:3, c("a", "b", "c"), ~test(.x, .y))
- The first df within the list would be
a, the secondband so on - The naming should be done within the function
- The option of
names(list.return) <- vector.of.list.names.in.characterdoes NOT work for me.
Please help