0% found this document useful (0 votes)
41 views3 pages

R Program 5

Packages in R are collections of functions, compiled code, and sample data stored in a library directory, with additional packages needing to be loaded explicitly. The Comprehensive R Archive Network (CRAN) is a key resource for accessing these packages, along with other repositories like Bioconductor and GitHub. Users can install and update packages through R or RStudio, which manage dependencies automatically during the installation process.

Uploaded by

karthikamohan474
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

R Program 5

Packages in R are collections of functions, compiled code, and sample data stored in a library directory, with additional packages needing to be loaded explicitly. The Comprehensive R Archive Network (CRAN) is a key resource for accessing these packages, along with other repositories like Bioconductor and GitHub. Users can install and update packages through R or RStudio, which manage dependencies automatically during the installation process.

Uploaded by

karthikamohan474
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Packages

Packages in R Programming language are a set of R functions, compiled

code, and sample data. A package is a container of predefined functions, which

are often designed to be general enough to solve a certain range of prob-

lems.These are stored under a directory called “library” within the R envi-

ronment. By default, R installs a group of packages during installation. Once

we start the R console, only the default packages are available by default. Other

packages that are already installed need to be loaded explicitly to be utilized

by the R program that’s getting to use them. R is powerful not only because

of its rich source of packages, but also because of the well-maintained package

archive system called The Comprehensive R Archive Network, or CRAN.

Repositories: A repository is a place where packages are located and stored

so you can install R packages from it. Organizations and Developers have a

local repository, typically they are online and accessible to everyone. Some of

the most popular repositories for R packages are:

1. CRAN

2. Bioconductor

3. Github

14 CHAPTER 1. INTRODUCTION TO R

1.5.1 Installing packages

How to Install Extra Packages for Windows Users in R:

In Windows you can use the Packages menu. You have several options, but

Install Package(s) is the one you will want most often. After you have selected

a local mirror site you are presented with a list of available binary packages

from which you can choose the ones you require (See the figure).
Once you have selected the packages you require, click OK at the bottom and

the packages will be downloaded and installed directly into R.

How to Install Extra Packages for Windows Users in R Studio: RStu-

dio also provides an easy way to install packages. Just go to the Packages pane

and click on Install. The following dialog appears:

1.5. PACKAGES 15

As the package description shows, a package may depend on other packages.

In other words, when you call a function in the package, the function also calls

some functions in other packages, which requires that you also install those

packages as well. Fortunately, install.packages() is smart enough to know the

dependency structure of the package to install and will install those packages

first.

You can see what packages are installed using the following command:

installed.packages()

1.5.2 Updating packages

By default, the install.packages() function installs the latest version of the

specified packages. Once they are installed, the package version stays fixed.

However, the packages may be updated to fix bugs or add new features. Some-

times, an updated version of a package may deprecate functions in older versions

with warnings. In these cases, we may update it.

RStudio provides an Update button next to Install in the package pane.

We can also use the following function and choose which packages are going to

be updated.
update.packages()

Both RStudio and the preceding function scan newer versions of packages

and install these packages along with dependencies if necessary.

You might also like