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

时间:2017-09-18 04:31:00

标签: r package r-caret failed-installation

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

> 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

2 个答案:

答案 0 :(得分:1)

您可能有过时的依赖项。尝试更新所有已安装的包。然后安装"插入符号"所有依赖项:
(install.packages("caret", dependencies = TRUE))
为我工作!

答案 1 :(得分:0)

我遇到了同样的问题,除了我不得不更新(重新安装)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