R Programming - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

R Packages

R Packages

shape Description

an R-Package is basically a collection of different items, such as, Functions, Datasets, Compiled code and Documentation. So typically, each package is intended for a certain area and are used to accomplish certain tasks in that area. These packages are available in some central repositories.

Commands To check Packages

shape Description

The following are the some commands to check packages availability.

.libPaths()

The .libPaths() is used to check the location R packages in the system. When run this command the following result will be displayed. [c]"C:/Program Files/R/R-3.2.2/library"[/c]

library()

The library() is used to check available packages on the system. When run this command the following result will be displayed. [c] base The R Base Package boot Bootstrap Functions (Originally by Angelo Canty for S) class Functions for Classification cluster "Finding Groups in Data": Cluster Analysis Extended Rousseeuw et al. codetools Code Analysis Tools for R compiler The R Compiler Package datasets The R Datasets Package foreign Read Data Stored by Minitab, S, SAS, SPSS, Stata, Systat, Weka, dBase, ... graphics The R Graphics Package grDevices The R Graphics Devices and Support for Colours and Fonts grid The Grid Graphics Package KernSmooth Functions for Kernel Smoothing Supporting Wand & Jones (1995) lattice Trellis Graphics for R MASS Support Functions and Datasets for Venables and Ripley's MASS Matrix Sparse and Dense Matrix Classes and Methods methods Formal Methods and Classes mgcv Mixed GAM Computation Vehicle with GCV/AIC/REML Smoothness Estimation nlme Linear and Nonlinear Mixed Effects Models nnet Feed-Forward Neural Networks and Multinomial Log-Linear Models parallel Support for Parallel computation in R rpart Recursive Partitioning and Regression Trees spatial Functions for Kriging and Point Pattern Analysis splines Regression Spline Functions and Classes stats The R Stats Package stats4 Statistical Functions using S4 Classes survival Survival Analysis tcltk Tcl/Tk Interface tools Tools for Package Development translations The R Translations Package utils The R Utils Package [/c]

search()

The search() is used to check current packages on the system. When run this command the following result will be displayed. [c] [1] ".GlobalEnv" "tools:rstudio" "package:stats" [4] "package:graphics" "package:grDevices" "package:utils" [7] "package:datasets" "package:methods" "Autoloads" [/c]

Install New Packages

To install a package, user need to first download the package, from some repository. So a repository can contain several packages, and user can download and install the required package from the repository. The repository has currently more than 5,500 packages as on date. And more and more packages are getting added to this repository. These packages are developed, for a variety of application areas. The following is the syntax to add the new package. [c]install.packages("Package Name")[/c] The following is an example to install XML package. [c]install.packages("XML")[/c] When user start working on various R based projects, user will be installing a number of R packages on machine. And over the period, this number can become very high. So user will have to maintain, these installed R packages. The maintenance include, updating existing packages, as well as, removal of packages that are no more required.

Summary

shape Key Points

  • All the packages will stored in the library folder.
  • The library() is the package to check the available packages.