# R Packages

We have mentioned that to analyze the example data from Jennifer and data from Jayfred we will use a "Linear Mixed Model" in R. Once again, the linear mixed model refers to a model having both fixed and random effects where * fixed effects* are factors such that all possible levels are included in the study (experiment). In contrast, in

*only a subset of all possible levels of the factors are included in the study.*

**random effects**Due to the fact that the standard installation of R natively (i.e. by default) does not include the ability to analyze linear mixed models, there is one additional step we must take before we begin. This involves adding the ability in R to be able to fit linear mixed models. This is a very simple step and can be accomplished by installing an additional "* Package*" to the R install on your computer. So let's understand what is the concept of the term "Package" in R.

## Defining the term "Package"

In general, software is developed with a core set of features (or functions) that are available to the user after the software is installed on their computer. Many times additional features (or functions) can be added to the software with the help of "Add On" that must be installed separately. This add on enhances the features and provides extended functionality to the existing software. On similar lines you can think about *R Packages* as collections of specialized R functions or features bundled together as an add on. A package can be installed on demand; a package also has a collection of data sets and function codes that are bundled within.

There are multiple packages available in R for one to install and use. These different packages bundle R functions that are specialized for a certain type of analysis in a field of science (and business, etc.). In order to use a package you must first install that package. Just like an add on, one particular type of R package only needs to be installed once on your computer. However every time you have to use one of these packages you must "load" them in your R session first (we will take a look at how to load the package later).

One of a few R packages that we will use is called "**Linear mixed-effects models using Eigen and S4 (lme4)"**. The documentation of the package in a PDF format is available at http://cran.r-project.org/web/packages/lme4/lme4.pdf and the summary is available at http://cran.r-project.org/web/packages/lme4/index.html. Now we will demonstrate how to install this R package in the short clip below.

In the above video we used the following command to install the lme4 package: *install.packages("lme4")*

To make sure you correctly understand what an R package is, and in particular, the one you need to fit linear mixed effect model, answer the following question.