Site icon DED9

Packages in the programming language R – R packets are a set of R functions

R packets are a set of R functions; Which match the sample data and code. They are stored in R directory under a directory called “library”. 

R packets are a set of R Functions, R installs a set of packages. More packages can be added later; That is, when they are needed for a specific purpose.

When we launch the R console; Only default packages are available. Other packages already installed; Must be explicitly downloaded by the R program; When using them; Be usable.

All packages available in the R programming language; In R packages are listed.

The following is a list of commands used to check, verify, and use R packets:

Check the packages available in R

.libPaths ()

When we run the above code; The following result is obtained. Of course, your computer’s local configuration package may change slightly.

[2] “C: / Program Files / R / R-3.2.2 / library”

Get a list of all installed packages

library ()

Packages in library ‘C: / Program Files / R / R-3.2.2 / library’:

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 Colors

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

utils The R Utils Package

Thus all packets currently loaded in R environment; it will be received.

search ()

When we execute the above code; The following result is obtained; Which, of course, may depend on your computer’s local settings; Slightly different:

[1] “.GlobalEnv” “package: stats” “package: graphics”

[4] “package: grDevices” “package: utils” “package: datasets”

[7] “package: methods” “Autoloads” “package: base”

Install a new package

There are two ways we can add new packages to R. One is to install directly from the CRAN directory and the other is to download a package for your local system and install it manually.

Direct installation from CRAN

The following command receives the packages directly from the CRAN website page and installs the packet in R environment. You may be asking to select the nearest mirror. Choose one that fits your location.

install.packages (“Package Name”)

# Install the package named “XML”.

install.packages (“XML”)

Install the package manually

See the R packages link . Download the required package. Save the package as a zip file to a convenient location on your local system.

You can now run the following command to install this package in R environment:

install.packages (file_name_with_path, repos = NULL, type = “source”)

# Install the package named “XML”

install.packages (“E: /XML_3.98-1.3.zip”, repos = NULL, type = “source”)

Load the package in the Library

Before a package can be use in coding, that package must be load in the current R environment. You should also; Load a package that was previously install but is not available in the current R environment. A package is loading using the following command.

library (“package Name”, lib.loc = “path to library”)

# Load the package named “XML”

install.packages (“E: /XML_3.98-1.3.zip”, repos = NULL, type = “source”)

Exit mobile version