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
name
input 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 secondb
and so on - The naming should be done within the function
- The option of
names(list.return) <- vector.of.list.names.in.character
does NOT work for me.
Please help