map_at 只有一个起始字符串 "Exampl"

map_at with just a starting string "Exampl"

我有一个列表,其中包含 aggregate() 从包 hts 创建的多个变量分组。我想根据组名映射一个特定的预测函数。

姓名示例:

G3/GRSA_
G3/COAR_
G4/COAR_RURA_
...

基本上我想要

map(list, contains*("COAR"), forecast)

预测 G3/COAR_G4/COAR_RURA_

传播问题

names_to_map <- 姓名(example_list) grsa_names <- names_to_map [str_detect(names_to_map , "GRSA")]

map_at(example_list,names_to_map,example_function)