Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在循环中创建对象并将其输入函数_R_Tidyverse - Fatal编程技术网

R 在循环中创建对象并将其输入函数

R 在循环中创建对象并将其输入函数,r,tidyverse,R,Tidyverse,我有以下r代码: df1关于: file <- lapply(filename, function(f) haven::read_sav(here::here("data", f))) do.call("stackDF", file) file我们可以使用map library(purrr) out <- map(filename, ~ haven::read_sav(here::here("data

我有以下r代码:

df1关于:

file <- lapply(filename, 
               function(f) haven::read_sav(here::here("data", f)))
do.call("stackDF", file)

file我们可以使用
map

library(purrr)
out <- map(filename, ~ haven::read_sav(here::here("data", f))) %>%
         reduce(stackDF)
库(purrr)
超出%
减少(stackDF)