Installing packages in R
Base installation of R does not have functions that can fit models that are tailored to certain disciplines e.g. Yield per Recruit model in fisheries management. In such cases, you may require functions written and contributed by experts. These contributions are known as “Packages”. They are free to download, install and use.
Find a useful package
The easiest way would be to search in google with carefully chosen keywords. Second option is to find the required package from a list in CRAN (Click Here).
Installing a package
You can install packages in R in two ways.
1. An automated process within R (Recommended but require internet while installation)
2. Manually install using ZIP files from CRAN website. (Download and install later)
1. Automated installation
A package may work only if some other packages are installed along with it. If you choose to install using the automated process, all other dependent packages required will be downloaded and installed by itself.
Go to Packages menu and then choose “Install Packages”. R will ask you to choose the nearest CRAN mirror. Choose a location very close to your place.
2. Manual installation
For manual installation, download the required ZIP files from CRAN website (For Windows). The most important thing to remember here is to download ZIP files of all the dependent packages as well.
The following example shows the CRAN website details of pgirmess, a package with functions useful for data analysis in ecology. The website says that this package work only if six other R packages are installed along with pgirmess i.e., boot, nlme, rgdal, sp, spdep and splancs. Hence you have to download ZIP files of all the dependent packages and install them along with pgirmess
Once the ZIP file is dowloaded, go to “Packages ” menu in R. Choose “Install package from local zip file”. It will ask you the location of the downloaded file in your computer. In this method of installation, R won’t automatically identify the extra packages (dependent ones) required. You have to manually download and install each one by one.