The vast majority of programs that have been written for R do not come with the default installation, but they can be easily installed from the command prompt or using R’s menus.
To install a new package by pointing-and-clicking through R’s menus in a Windows environment, first go to Packages → Install package(s)….
If a CRAN mirror has not yet been set for the current R session, a list of servers will display.
Choose the nearest mirror and click OK. Next, a list of packages displays. Scroll down and select the package of interest. For example, say you are interested in downloading the sem package for structural equation models. Highlight it, and click on OK.
Use the library function to load the package.
Installing Packages from the R Command Prompt
To install a new package from the command prompt, use the function install.packages with the package name (in quotes) as the argument. For example, to install the sem package for structural equation models, enter:
If no CRAN mirror has yet been specified, it may be necessary to choose one by entering the number corresponding to the nearest location. One can also use the chooseCRANmirror() function, called without any arguments, to change the preferred server at any time.
Once the new package has been downloaded and installed, use the library function to load it.
Consult the help files for each of these functions for more information.
Still have questions? Contact us!