首页 > 解决方案 > R purrr pmap 无法从闭包中拔出

问题描述

我在这里做错了什么?:

library(tidyverse)
calling_dataset <- tibble(filepath="xxx.csv")

testfunction1 <- 
 getdrugdata <- function(filepath){
   print(filepath)
 }

test1 <- calling_dataset %>%  
  purrr::pmap_df(list(
  .$filepath), testfunction1)

产生的错误是:错误:无法从闭包中取出。

标签: rpurrr

解决方案


更改调用:

purrr::pmap_df(list(calling_dataset$filepath), testfunction1)

秩序恢复了宇宙。


推荐阅读