An introduction to R packages based on 11 of the most frequently asked user questions. Following vignettes is a great way to get your hands dirty with the common uses of the package, so it's a perfect way to start working with it before doing your own analysis. The function install.packages() is used to install a package from CRAN. The help pane for a package will provide you the same information as the web page (downloads, description, a list of functions, details), plus information about your installed version of the package. By default, R installs a set of packages during installation. Example: to use the Ghent University Library mirror (Belgium) to install the vioplot package you can run the following: In the case of Bioconductor, the standard way of installing a package is by first executing the following script: This will install some basic functions needed to install bioconductor packages, such as the biocLite() function. Just like the CRAN task views, RDocumentation also offers. If you are new to dplyr, the best place to start is the data import chapter in R for data science. Get library locations containing R packages. But imagine that you'd like to do some natural language processing of Korean texts, extract weather data from the web, or even estimate actual evapotranspiration using land surface energy balance models, R packages got you covered! The function install.packages() is used to install a package from CRAN. This function will prompt you to select the mirror closest to your location and will install the desired package. Ability to install or update a package directly from the help panel. In the following R code, we want to install the R/Bioconductor package limma, which is dedicated to analyse genomic data. Don’t forget to check the Matrix Function in R. Installing by the Name of Package. For example, you might remember that to obtain the help file of the vioplot command from the vioplot package, you can type: Tip: you can also use another way to see what is inside a loaded package. Please don’t get confused: library() is the command used to load a package, and it refers to the place where the package is contained, usually a folder on your computer, while a package is the collection of functions bundled conveniently. Typically, a package will include code (not only R code! It makes sharing your package easy. For example, if you are usually working with data frames, probably you will have heard about dplyr or data.table, two of the most popular R packages. Let’s get R Markdown and knitr installed so we can use them in our exercises. You might probably have installed it on your computer already, but if not, this is your chance to do it and test your new install.packages() skills. Note that you can also click here to see the DESCRIPTION file. To install it from CRAN, you will need to use: After running this, you will receive some messages on the screen. In any case, welcome to this introduction to R packages and how to use them! You'll have the right package in no time, guaranteed! On the Owens cluster, it is ~/R/x86_64-unknown-linux-gnu-library/3.3 if the default R-3.3.2 module is loaded. Depending on what platform you are, these messages can differ. Packages can be installed either from CRAN (for general packages), from Bioconductor (for biology-related packages) or from Github (developing versions of packages). And I almost forgot, if you haven’t discovered yet by searching on RDocumentation, I can tell you that with weatherData you can extract weather data from the internet, and if you are interested in evapotranspiration, maybe you should take a look at the Evapotranspiration, water, or SPEI packages. Here you have more details about devtools and installation. The simplest way to do this is with the library() command. You can also select your mirror by using the chooseCRANmirror(), or directly inside the install.packages() function by using the repo parameter. To use a specific function available in an R package, you have to load the R package using the function library(). This analysis has been performed using R software (ver. The last piece of information is telling you where the original files from the package are located. All the packages available in R language are listed at R Packages. The list of functions included in the package, where each of them is clickable so you can get more details about the use of the function. Speaking about popularity, this is relevant because the search will rank the most downloaded packages first, in a way to improve the relevance of the results. Another good reminder of this difference is to run the function library() without arguments. You should first install devtools if you don’t have it installed on your computer. The documentation: what are, besides the DESCRIPTION file, Choosing between R packages: how do you find. You also need to load a package that is already installed previously but not available in the current environment. Do you remember how to see an overview of what functions and data are contained in a package? You’ll cover the following topics, and 11 frequently asked user questions: If you are a more experienced user, you can always learn something new (like the name of the three packages I just mentioned in the previous paragraph). Then you will need two more sources of documentation: help files and vignettes. Use the following command to install any package: install.packages(‘ade4’) The following figure shows the installation of an ade4 package by using its name: R Packages List Three of the most popular repositories for R packages are: How you can install a package will depend on where it is located. A package is a suitable way to organize your own work and, if you want to, share it with others.