R Packages

R Packages are preassembled collections of functions and objects.

Package Installation: Here, installing dplyr package.

1. Open Rstudio.
2. Make sure you are connected to Internet.
3. install.packages(“dplyr”).
4.We cant use functions of dplyr with Installation of package. We can use the functions of package after load it into R session. This can be done with library or require function.


> install.packages("dplyr") Installing package into ‘C:/Users/pinnapav/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/dplyr_0.7.2.zip' Content type 'application/zip' length 2881002 bytes (2.7 MB) downloaded 2.7 MB package ‘dplyr’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\pinnapav\AppData\Local\Temp\RtmpwhEHEd\downloaded_packages > require(dplyr) Loading required package: dplyr Attaching package: ‘dplyr’ The following objects are masked from ‘package:stats’: filter, lag The following objects are masked from ‘package:base’: intersect, setdiff, setequal, union Warning message: package ‘dplyr’ was built under R version 3.3.3 > library(dplyr)

How to check package is loaded into R session or not?

We can get this information using function sessionInfo().

> sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] dplyr_0.7.2 ggplot2_2.2.1 loaded via a namespace (and not attached): [1] Rcpp_0.12.12 assertthat_0.2.0 grid_3.3.1 plyr_1.8.4 R6_2.2.2 gtable_0.2.0 [7] magrittr_1.5 scales_0.4.1 rlang_0.1.1 lazyeval_0.2.0 bindrcpp_0.2 tools_3.3.1 [13] glue_1.1.1 munsell_0.4.3 pkgconfig_2.0.1 colorspace_1.3-2 bindr_0.1 tibble_1.3.3

Powered by WordPress