01 CRAN packages

CRAN stands for Comprehensive R Archive Network.

View list of installed packages using either of the following commands

> library()
> rownames(installed.packages())

View list of loaded packages in the session

> search()

Install package using

> install.packages("caTools")

Load the package to the session, either of the following 2 commands work

> library(caTools)
> require(caTools)

Unload a package from R session

> detach("package:caTools", unload = TRUE)

Help document for a package

> library(help = "caTools")

View the list of examples of code for a specific package

> browseVignettes(package = "grid") 

View examples of code for the currently installed packages

> browseVignettes() 

Update packages

> update.packages("caTools")

Remove/uninstall a package from R

> remove.packages("caTools")

Install popular r packages

> install.packages(c("ggplot2", "car", "caret", "dplyr", "caTools", "devtools", "knitr", "doParallel", "GGally", "Hmisc", "MASS", "sqldf", "psych", "ROCR", "rpart", "rpart.plot", "randomForest", "Metrics", "e1071", "reshape2", "xgboost"))

View information about an environment.

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
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.4/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] ROCR_1.0-7   gplots_3.0.1
loaded via a namespace (and not attached):
 [1] gtools_3.5.0        kernlab_0.9-25      reshape2_1.4.2      purrr_0.2.3         splines_3.4.2       lattice_0.20-35    
 [7] colorspace_1.3-2    stats4_3.4.2        survival_2.41-3     prodlim_1.6.1       rlang_0.1.2         ModelMetrics_1.1.0 
[13] glue_1.1.1          withr_2.0.0         xgboost_0.6-4       bindrcpp_0.2        foreach_1.4.3       bindr_0.1          
[19] plyr_1.8.4          dimRed_0.1.0        lava_1.5.1          robustbase_0.92-7   stringr_1.2.0       timeDate_3012.100  
[25] munsell_0.4.3       gtable_0.2.0        recipes_0.1.0       caTools_1.17.1      codetools_0.2-15    caret_6.0-77       
[31] class_7.3-14        DEoptimR_1.0-8      Rcpp_0.12.13        KernSmooth_2.23-15  scales_0.5.0        gdata_2.18.0       
[37] ipred_0.9-6         CVST_0.2-1          ggplot2_2.2.1       stringi_1.1.5       dplyr_0.7.4         RcppRoll_0.2.2     
[43] ddalpha_1.3.1       grid_3.4.2          tools_3.4.2         bitops_1.0-6        magrittr_1.5        lazyeval_0.2.0     
[49] tibble_1.3.4        DRR_0.0.2           pkgconfig_2.0.1     MASS_7.3-47         Matrix_1.2-11       data.table_1.10.4-2
[55] lubridate_1.6.0     gower_0.1.2         assertthat_0.2.0    iterators_1.0.8     R6_2.2.2            rpart_4.1-11       
[61] sfsmisc_1.1-1       nnet_7.3-12         nlme_3.1-131        compiler_3.4.2