monkeyshines
monkeyshines

Reputation: 1078

Installed caret in R but unable to use in library

This is the code and error message I am getting:

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

I am using a mac. I also use this at work on a PC and haven't had any problems.

I also ran sessionInfo() as 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

Upvotes: 3

Views: 1463

Answers (2)

Tomas Hrubovcak
Tomas Hrubovcak

Reputation: 355

I just ran into the same issue, except I got stuck at updating (reinstalling) the lubridate package. Some of the errors I got looked something like:

./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

turned out my gcc compiler (running RHEL 6.8) was too old (4.4.7). Since I couldn't upgrade the compiler itself, I installed a devtoolset. then, I fixed my problem by enabling the devtoolset before running R:

scp enable devtoolset-4 R

Upvotes: 0

N.Hamoud
N.Hamoud

Reputation: 26

You may have outdated dependencies. Try updating all installed packages. Then install "caret" with all dependencies :
(install.packages("caret", dependencies = TRUE)).
Worked for me!

Upvotes: 1

Related Questions