Category Archives: Uncategorized

Install R packages

If you know the name of the package, then the easiest way is to use the R console. Just enter the name of the package and set the mirror site. I typically use

At the R prompt, type

install.packages(“R package”, repos=””)

where “R package” is a place holder for any of the packages you wish to install. For example, to download the package Rcmdr, enter

install.packages(“Rcmdr”, repos=””)

Assuming all goes well you will see some lines appear in red type beginning with the phrase “trying url…” and, if successful, a message in black that begins “The downloaded binary packages are in …”

Note that the package has been installed, but the functions and other features in the package are not available to you until you load the package into your R session. In general, this is accomplished by simply typing at the R prompt

library(R package)

After pressing the <enter> key, the package will be available for your use.