# 计算斜率
slopes <- word_month_counts %>%
nest(-word) %>%
mutate(model = map(data, mod)) %>%
mutate(models = map(model,tidy)) %>%
unnest(cols = c(models)) %>%
filter(term == "year") %>%
arrange(desc(estimate))
Warning message:
"All elements of `...` must be named.
Did you want `data = -word`?"
Error in `mutate()`:
! Problem while computing `model = map(data, mod)`.
Caused by error:
! 参数mu必需为非空数字向量
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] scifetch_0.1.0 scales_1.1.1 broom_0.7.12 tidytext_0.3.2
[5] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.8 purrr_0.3.4
[9] readr_2.1.2 tidyr_1.2.0 tibble_3.1.6 ggplot2_3.3.5
[13] tidyverse_1.3.1 lubridate_1.8.0 pacman_0.5.1
loaded via a namespace (and not attached):
[1] httr_1.4.2 jsonlite_1.8.0 modelr_0.1.8
[4] assertthat_0.2.1 BiocManager_1.30.16 cellranger_1.1.0
[7] remotes_2.4.2 pillar_1.7.0 backports_1.4.1
[10] lattice_0.20-45 glue_1.6.2 uuid_1.0-4
[13] digest_0.6.29 rvest_1.0.2 colorspace_2.0-3
[16] htmltools_0.5.2 Matrix_1.4-1 pkgconfig_2.0.3
[19] haven_2.4.3 processx_3.5.3 tzdb_0.3.0
[22] generics_0.1.2 ellipsis_0.3.2 withr_2.5.0
[25] repr_1.1.4 cli_3.2.0 magrittr_2.0.3
[28] crayon_1.5.1 readxl_1.4.0 evaluate_0.15
[31] ps_1.6.0 tokenizers_0.2.1 janeaustenr_0.1.5
[34] fs_1.5.2 fansi_1.0.3 SnowballC_0.7.0
[37] xml2_1.3.3 pkgbuild_1.3.1 tools_4.1.3
[40] prettyunits_1.1.1 hms_1.1.1 lifecycle_1.0.1
[43] munsell_0.5.0 reprex_2.0.1 callr_3.7.0
[46] compiler_4.1.3 rlang_1.0.2 grid_4.1.3
[49] pbdZMQ_0.3-7 IRkernel_1.3 rstudioapi_0.13
[52] base64enc_0.1-3 gtable_0.3.0 DBI_1.1.2
[55] curl_4.3.2 R6_2.5.1 fastmap_1.1.0
[58] utf8_1.2.2 rprojroot_2.0.2 stringi_1.7.6
[61] IRdisplay_1.1 Rcpp_1.0.8.3 vctrs_0.4.0
[64] dbplyr_2.1.1 tidyselect_1.1.2