在 R 中安装插入符号但无法在库中使用

Installed caret in R but unable to use in library

这是我收到的代码和错误消息:

> library(caret)
Error : object ‘semester’ is not exported by 'namespace:lubridate'
Error: package or namespace load failed for ‘caret’

我正在使用 mac。我也在 PC 上工作时使用它,没有遇到任何问题。

我也运行 sessionInfo() 作为adivsed

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lattice_0.20-34    factoextra_1.0.5   FactoMineR_1.36    e1071_1.6-8       

[5] GGally_1.3.0       ggrepel_0.6.5      RColorBrewer_1.1-2 stringr_1.2.0     
 [9] tidyr_0.6.1        dplyr_0.7.3        data.table_1.10.4  ggplot2_2.2.1     

loaded via a namespace (and not attached):
 [1] reshape2_1.4.1       kernlab_0.9-25       splines_3.3.3       
 [4] colorspace_1.3-2     prodlim_1.6.1        survival_2.40-1     
 [7] rlang_0.1.2          ModelMetrics_1.1.0   glue_1.1.1          
 [10] bindrcpp_0.2         foreach_1.4.3        bindr_0.1           
 [13] plyr_1.8.4           lava_1.5             dimRed_0.1.0        
 [16] robustbase_0.92-7    timeDate_3012.100    munsell_0.4.3       
 [19] gtable_0.2.0         leaps_3.0            codetools_0.2-15    
 [22] class_7.3-14         DEoptimR_1.0-8       Rcpp_0.12.9         
 [25] scales_0.4.1         flashClust_1.01-2    ipred_0.9-6         
 [28] scatterplot3d_0.3-40 CVST_0.2-1           stringi_1.1.2       
 [31] RcppRoll_0.2.2       ddalpha_1.2.1        grid_3.3.3          
 [34] tools_3.3.3          magrittr_1.5         lazyeval_0.2.0      
 [37] tibble_1.3.4         cluster_2.0.5        DRR_0.0.2           
 [40] pkgconfig_2.0.1      MASS_7.3-45          Matrix_1.2-8        
 [43] lubridate_1.5.6      gower_0.1.2          assertthat_0.1      
 [46] reshape_0.8.6        iterators_1.0.8      R6_2.2.0            
 [49] rpart_4.1-10         nnet_7.3-12          nlme_3.1-131

您可能有过时的依赖项。尝试更新所有已安装的软件包。然后安装 "caret" 和所有依赖项:
(install.packages("caret", dependencies = TRUE))
对我有用!

我只是 运行 遇到了同样的问题,除了我在更新(重新安装)lubridate 包时卡住了。我得到的一些错误看起来像:

./cctz/include/civil_time_detail.h:37: error: expected nested-name-specifier before ‘year_t’
./cctz/include/civil_time_detail.h:37: error: ‘year_t’ has not been declared
./cctz/include/civil_time_detail.h:37: error: expected ‘;’ before ‘=’ token
./cctz/include/civil_time_detail.h:37: error: expected unqualified-id before ‘=’ token

我的 gcc 编译器 (运行 RHEL 6.8) 太旧了 (4.4.7)。由于我无法升级编译器本身,所以我安装了一个 devtoolset。 然后,我通过在 运行 R:

之前启用 devtoolset 来解决我的问题
scp enable devtoolset-4 R