尝试在R脚本中加载tidyverse软件包时,出现以下错误消息:
library(tidyverse)
-- Attaching packages -------------------------------------------------tidyverse 1.2.1 --
v tibble 1.4.2 v purrr 0.2.5
v tidyr 0.8.1 v stringr 1.3.1
v tibble 1.4.2 v forcats 0.3.0
错误:“ tidyverse”的包或名称空间加载失败: .onAttach在“ tidyverse”的attachNamespace()中失败,详细信息: 通话:NULL
错误:$运算符对原子向量无效
但是,当我尝试通过控制台进行加载时,程序包将成功加载。
下面是traceback()
> traceback()
6: stop(msg, call. = FALSE, domain = NA)
5: value[[3L]](cond)
4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
3: tryCatchList(expr, classes, parentenv, handlers)
2: tryCatch({
attr(package, "LibPath") <- which.lib.loc
ns <- loadNamespace(package, lib.loc)
env <- attachNamespace(ns, pos = pos, deps)
}, error = function(e) {
P <- if (!is.null(cc <- conditionCall(e)))
paste(" in", deparse(cc)[1L])
else ""
msg <- gettextf("package or namespace load failed for %s%s:\n %s",
sQuote(package), P, conditionMessage(e))
if (logical.return)
message(paste("Error:", msg), domain = NA)
else stop(msg, call. = FALSE, domain = NA)
})
1: library(tidyverse)
下面是sessionInfo():
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.3.1 purrr_0.2.5 tidyr_0.8.1 tibble_1.4.2 tidyverse_1.2.1
[6] lubridate_1.7.4 zoo_1.8-3 Hmisc_4.1-1 Formula_1.2-3 survival_2.42-3
[11] lattice_0.20-35 shinyjs_1.0 htmltools_0.3.6 DT_0.4 readr_1.1.1
[16] leaflet_2.0.1 plotly_4.8.0 ggplot2_3.0.0 shinydashboard_0.7.0 dplyr_0.7.6
[21] plyr_1.8.4 magrittr_1.5 taRifx_1.0.6.1 rjson_0.2.20 anytime_0.3.1
loaded via a namespace (and not attached):
[1] httr_1.3.1 jsonlite_1.5 viridisLite_0.3.0 splines_3.5.1 modelr_0.1.2
[6] shiny_1.1.0 assertthat_0.2.0 latticeExtra_0.6-28 cellranger_1.1.0 yaml_2.2.0
[11] pillar_1.2.3 backports_1.1.2 glue_1.2.0 digest_0.6.15 RColorBrewer_1.1-2
[16] promises_1.0.1 checkmate_1.8.5 rvest_0.3.2 colorspace_1.3-2 httpuv_1.4.4.2
[21] Matrix_1.2-14 pkgconfig_2.0.1 broom_0.5.0 haven_1.1.2 xtable_1.8-2
[26] scales_0.5.0 later_0.7.3 htmlTable_1.12 withr_2.1.2 nnet_7.3-12
[31] lazyeval_0.2.1 cli_1.0.0 crayon_1.3.4 readxl_1.1.0 mime_0.5
[36] nlme_3.1-137 xml2_1.2.0 forcats_0.3.0 foreign_0.8-70 tools_3.5.1
[41] data.table_1.11.4 hms_0.4.2 RApiDatetime_0.0.3 munsell_0.5.0 cluster_2.0.7-1
[46] bindrcpp_0.2.2 compiler_3.5.1 rlang_0.2.2 grid_3.5.1 rstudioapi_0.7
[51] htmlwidgets_1.2 crosstalk_1.0.0 base64enc_0.1-3 gtable_0.2.0 reshape2_1.4.3
[56] R6_2.2.2 gridExtra_2.3 knitr_1.20 bindr_0.1.1 stringi_1.1.7
[61] Rcpp_0.12.17 rpart_4.1-13 acepack_1.4.1 tidyselect_0.2.4