Install and Load R Packages

Here is an example of install and load packages. In that example we have install and load “dslabs” package.

> install.packages("dslabs")

Installing package into '\\FS06/Users6/A82893/Dokument/R/win-library/3.6'

(as 'lib' is unspecified)

--- Please select a CRAN mirror for use in this session ---

also installing the dependencies 'ellipsis', 'glue', 'magrittr', 'stringi', 'colorspace', 'assertthat', 'utf8', 'vctrs', 'plyr', 'Rcpp', 'stringr', 'farver', 'labeling', 'munsell', 'R6', 'RColorBrewer', 'lifecycle', 'cli', 'crayon', 'fansi', 'pillar', 'pkgconfig', 'digest', 'gtable', 'lazyeval', 'reshape2', 'rlang', 'scales', 'tibble', 'viridisLite', 'withr', 'ggplot2'

 

  There are binary versions available but the source versions are later:

        binary source needs_compilation

stringi  1.4.4  1.4.5              TRUE

rlang    0.4.3  0.4.4              TRUE

 

  Binaries will be installed

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/ellipsis_0.3.0.zip'

Content type 'application/zip' length 44573 bytes (43 KB)

downloaded 43 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/glue_1.3.1.zip'

Content type 'application/zip' length 173021 bytes (168 KB)

downloaded 168 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/magrittr_1.5.zip'

Content type 'application/zip' length 157607 bytes (153 KB)

downloaded 153 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/stringi_1.4.4.zip'

Content type 'application/zip' length 15307078 bytes (14.6 MB)

downloaded 14.6 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/colorspace_1.4-1.zip'

Content type 'application/zip' length 2550276 bytes (2.4 MB)

downloaded 2.4 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/assertthat_0.2.1.zip'

Content type 'application/zip' length 55189 bytes (53 KB)

downloaded 53 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/utf8_1.1.4.zip'

Content type 'application/zip' length 215378 bytes (210 KB)

downloaded 210 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/vctrs_0.2.2.zip'

Content type 'application/zip' length 944451 bytes (922 KB)

downloaded 922 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/plyr_1.8.5.zip'

Content type 'application/zip' length 1304390 bytes (1.2 MB)

downloaded 1.2 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/Rcpp_1.0.3.zip'

Content type 'application/zip' length 2990152 bytes (2.9 MB)

downloaded 2.9 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/stringr_1.4.0.zip'

Content type 'application/zip' length 217081 bytes (211 KB)

downloaded 211 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/farver_2.0.3.zip'

Content type 'application/zip' length 1912728 bytes (1.8 MB)

downloaded 1.8 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/labeling_0.3.zip'

Content type 'application/zip' length 62937 bytes (61 KB)

downloaded 61 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/munsell_0.5.0.zip'

Content type 'application/zip' length 245705 bytes (239 KB)

downloaded 239 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/R6_2.4.1.zip'

Content type 'application/zip' length 59324 bytes (57 KB)

downloaded 57 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/RColorBrewer_1.1-2.zip'

Content type 'application/zip' length 55569 bytes (54 KB)

downloaded 54 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/lifecycle_0.1.0.zip'

Content type 'application/zip' length 84783 bytes (82 KB)

downloaded 82 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/cli_2.0.1.zip'

Content type 'application/zip' length 389493 bytes (380 KB)

downloaded 380 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/crayon_1.3.4.zip'

Content type 'application/zip' length 749996 bytes (732 KB)

downloaded 732 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/fansi_0.4.1.zip'

Content type 'application/zip' length 224024 bytes (218 KB)

downloaded 218 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/pillar_1.4.3.zip'

Content type 'application/zip' length 184694 bytes (180 KB)

downloaded 180 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/pkgconfig_2.0.3.zip'

Content type 'application/zip' length 22176 bytes (21 KB)

downloaded 21 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/digest_0.6.23.zip'

Content type 'application/zip' length 249150 bytes (243 KB)

downloaded 243 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/gtable_0.3.0.zip'

Content type 'application/zip' length 434345 bytes (424 KB)

downloaded 424 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/lazyeval_0.2.2.zip'

Content type 'application/zip' length 173125 bytes (169 KB)

downloaded 169 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/reshape2_1.4.3.zip'

Content type 'application/zip' length 626426 bytes (611 KB)

downloaded 611 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/rlang_0.4.3.zip'

Content type 'application/zip' length 1121133 bytes (1.1 MB)

downloaded 1.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/scales_1.1.0.zip'

Content type 'application/zip' length 556607 bytes (543 KB)

downloaded 543 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/tibble_2.1.3.zip'

Content type 'application/zip' length 336957 bytes (329 KB)

downloaded 329 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/viridisLite_0.3.0.zip'

Content type 'application/zip' length 60757 bytes (59 KB)

downloaded 59 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/withr_2.1.2.zip'

Content type 'application/zip' length 151884 bytes (148 KB)

downloaded 148 KB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/ggplot2_3.2.1.zip'

Content type 'application/zip' length 3975447 bytes (3.8 MB)

downloaded 3.8 MB

 

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.6/dslabs_0.7.3.zip'

Content type 'application/zip' length 4696999 bytes (4.5 MB)

downloaded 4.5 MB

 

package 'ellipsis' successfully unpacked and MD5 sums checked

package 'glue' successfully unpacked and MD5 sums checked

package 'magrittr' successfully unpacked and MD5 sums checked

package 'stringi' successfully unpacked and MD5 sums checked

package 'colorspace' successfully unpacked and MD5 sums checked

package 'assertthat' successfully unpacked and MD5 sums checked

package 'utf8' successfully unpacked and MD5 sums checked

package 'vctrs' successfully unpacked and MD5 sums checked

package 'plyr' successfully unpacked and MD5 sums checked

package 'Rcpp' successfully unpacked and MD5 sums checked

package 'stringr' successfully unpacked and MD5 sums checked

package 'farver' successfully unpacked and MD5 sums checked

package 'labeling' successfully unpacked and MD5 sums checked

package 'munsell' successfully unpacked and MD5 sums checked

package 'R6' successfully unpacked and MD5 sums checked

package 'RColorBrewer' successfully unpacked and MD5 sums checked

package 'lifecycle' successfully unpacked and MD5 sums checked

package 'cli' successfully unpacked and MD5 sums checked

package 'crayon' successfully unpacked and MD5 sums checked

package 'fansi' successfully unpacked and MD5 sums checked

package 'pillar' successfully unpacked and MD5 sums checked

package 'pkgconfig' successfully unpacked and MD5 sums checked

package 'digest' successfully unpacked and MD5 sums checked

package 'gtable' successfully unpacked and MD5 sums checked

package 'lazyeval' successfully unpacked and MD5 sums checked

package 'reshape2' successfully unpacked and MD5 sums checked

package 'rlang' successfully unpacked and MD5 sums checked

package 'scales' successfully unpacked and MD5 sums checked

package 'tibble' successfully unpacked and MD5 sums checked

package 'viridisLite' successfully unpacked and MD5 sums checked

package 'withr' successfully unpacked and MD5 sums checked

package 'ggplot2' successfully unpacked and MD5 sums checked

package 'dslabs' successfully unpacked and MD5 sums checked

 

The downloaded binary packages are in

        C:\Users\User1\AppData\Local\Temp\RtmpsrtKfc\downloaded_packages

  

Once the package is installed, we can download the package into R session using the library function as follows:

> library(dslabs)

>

 If the package is not installed then you will get following errors:

> library(dslabs)

If you want to install more than one package at once:

Example: Following command will install two package “tidyverse” and “dslabs”

> install.packages(c(“tidyverse”,"dslabs"))

You can also Install Package from RStudio:



Comments