Error using 'segmented' with lm extracted from output of tidyverse 'map' in R
问题 I am using the 'segmented' package to find break points in linear regressions in R library(tidyverse) library(segmented) df <- data.frame(x = c(1:10), y = c(1,1,1,1,1,6:10)) lm_model <- lm(y ~ x, data = df) seg_model <- segmented(obj = lm_model, seg.Z = ~ x) But if I run the same model within a purrr:map, segmented fails. map_test <- df %>% nest() %>% mutate(map_lm = map(data, ~lm(y ~ x, data = .)), param_map_lm = map(map_lm, tidy)) map_lm_model <- map_test[[2]][[1]] map_seg_model <-