0

我有以下数据——

structure(list(k = structure(c(17563, 17591, 17622, 17652, 17683
), class = "Date"), startdt = structure(c(17532, 17561, 17589, 
17620, 17650), class = "Date"), enddt = structure(c(17560, 17588, 
17619, 17649, 17652), class = "Date")), row.names = c(NA, -5L
), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), .Names = c("k", 
"startdt", "enddt"), vars = "k", drop = TRUE, indices = list(
0L, 1L, 2L, 3L, 4L), group_sizes = c(1L, 1L, 1L, 1L, 1L), 
biggest_group_size = 1L, labels = structure(list(
k = structure(c(17563, 17591, 17622, 17652, 17683), class = "Date")), 
row.names = c(NA, 
-5L), class = "data.frame", vars = "k", drop = TRUE, .Names = "k"))

我想将它传递给一个函数。这是我将如何使用不存在的map3(万岁)-

dates %>% map3_df(.x = $.k, .y = $.startdt, .z = $.enddt,
 .f = ~ fetchdata(startdate = .z, enddate = .z, k = .x)

Pmap可能是一种选择?我只是不太熟悉,一个问题似乎是我无法明确分配变量(即.x、.y、.z),而我想要映射到的函数需要大量可选变量(而且我只想指定 startdate、enddt 和 k)。

任何帮助表示赞赏,在此先感谢。

4

0 回答 0