We need a map2 at the end because we are applying augment on corresponding list elements of 'kmeans' and 'value' columnlibrary(tidyverse)library(broom)kclust2 <- results %>% as_tibble() %>% select(-id_row) %>% group_by(year_row) %>% nest(.key = "value") %>% filter(map_int(value, nrow) > 4) %>% mutate(kmeans = map(value, ~kmeans(.x[[1]], centers = 4, iter.max = 10, nstart = 1)), tidied = map(kmeans, tidy), glanced = map(kmeans, glance), augmented = map2(kmeans, value, augment)) 这篇关于变异/小标题中的自定义功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-15 03:50