我每天在R代码中使用管道功能%>%
。前几天,我更新了R Studio及其所有软件包,现在%>%
不再可用。
我已经重新启动并尝试重新加载dplyr和tidyverse软件包。
install.packages(dplyr)
library(dplyr)
install.packages(tidyverse)
library(tidyverse)
psu_fk_abun99_16 = psu_fk_abun %>%
col_types = cols(protected_status = col_character())
psu_fk_abun中的错误%>%col_types = cols(protected_status = col_character()):找不到函数“%>%<-”
sessionInfo(package = NULL)
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] magrittr_1.5 forcats_0.3.0 stringr_1.4.0 purrr_0.3.2 readr_1.3.0 tidyr_0.8.2 tibble_2.1.1 ggplot2_3.1.0
[9] tidyverse_1.2.1 dplyr_0.8.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 cellranger_1.1.0 pillar_1.3.1 compiler_3.5.1 plyr_1.8.4 bindr_0.1.1 tools_3.5.1 packrat_0.5.0
[9] lubridate_1.7.4 jsonlite_1.6 nlme_3.1-137 gtable_0.2.0 lattice_0.20-38 pkgconfig_2.0.2 rlang_0.3.4 cli_1.0.1
[17] rstudioapi_0.10 haven_2.0.0 xfun_0.6 bindrcpp_0.2.2 withr_2.1.2 xml2_1.2.0 httr_1.4.0 knitr_1.21
[25] generics_0.0.2 hms_0.4.2 grid_3.5.1 tidyselect_0.2.5 glue_1.3.0 R6_2.3.0 readxl_1.1.0 modelr_0.1.2
[33] backports_1.1.3 scales_1.0.0 rvest_0.3.2 assertthat_0.2.0 colorspace_1.3-2 stringi_1.2.4 lazyeval_0.2.1 munsell_0.5.0
[41] broom_0.5.1 crayon_1.3.4
答案 0 :(得分:1)
您不能像这样使用magrittr
管道:
您正在尝试两个对象同时创建两个对象。一个是psu_fk_abun99_16
,另一个是col_types(psu_fk_abun)
。警告告诉您,这是不可能的。
您的代码似乎丢失了一部分:可能意外删除了一行代码。函数“ col_types”在tidyverse
的最新版本中不存在,但是是read_csv
的自变量。因此,表达式col_types(psu_fk_abun)
毫无意义。
您知道您以前使用过哪些软件包版本吗?