So this lecture is about installing R Packages. When you download R from the comprehensive R Archive Network CRAN, you get the base R system. And this includes a bunch of functions that you can use to summarize data and make plots and things like that. It basically covers the basic function, functionality that you'll need including implementing the R language. But the real reason R is so useful is that there are a lot of add-on packages that extend this basic functionality in a bunch of different directions. Everything from cleaning data, to plotting data, to analyzing data and making interactive applications. So, R Packages are developed and published by the larger R community, hopefully including you at the end of this course. So, to obtain R Packages the primary place that you're going to go is CRAN. But for some biological applications, and some big data applications, you might also go to the Bioconductor Project that I have linked to both the websites here. You can also obtain information about the available packages on CRAN with the available packages function. And so what you would do is you can enter R, start up, and you'll get a prompt and you can type this command: a. And then give it the available packages argument just like this. And that will be a large number of packages. So you could just hit a after you hit that you could just type a and hit return and you would see all the packages, but there would be thousands. So instead you can use the head command to look at say a certain number, say just three of those, packages so these are the first three in alphabetical order. As of the making of this lecture there are approximately 5200 packages on CRAN covering a wide range of topics. An equally large number available on Bioconductor. One thing that you can do is if you know the area that you're working in, but you don't know the R package you're after, you can go to the Task Views link which groups together many R packages that are related to a specific topic. So to install an R Package you primarily use the function install.packages. So what you would, you could do is just use that with the package name as the argument. So for example if I want to install the Slidify package what I would do is I would just type install.packages and then in quotes, slidify. And what that would do is that would go to CRAN and it would install that package on your computer. Any package on which that package depends will also be downloaded and installed. This is actually one of the nicest parts about R, is that it's relatively straightforward to install new packages. You can also install multiple R packages with a single line, so what you do is you again, you type, install.packages. And now what you do is you enclose in parentheses, with a C out front. All the different package names separated by commas, and surrounded by parenth, or surrounded by quotes. And then what that would do is install the slidify, ggplot2, and devtools packages. You can also install packages relatively straightforward procedure in RStudio, so hopefully you've installed R in RStudio. You can go up to the Tools Menu and then just go down to Install Packages, and that will open up a folder that will allow you to pick the repository and then pick the package that you want to be able to install from, and it will install that package for you. Installing packages from Bioconductor is a little bit different. You don't use install.package, but it's still quite since, straightforward. So what you do is you go and you type this command, source and then this website right here, and that will load the biocLite function. And so then first you just type biocLite by itself and what that will do is it will install the basic version of Bioconductor. That's actually quite a few packages so be prepared for a lot of packages to be installed the first time you run it. Then the next time you want to install specific package you again would do just like you would install.packages. As you type biocLite and then c, parentheses, and then each package name in quotation part, marks separated by a comma. So that's how you install packages like that. You can also load the packages after you've installed them. So if you install it, it doesn't mean that all of the functions are immediately available to you. You need to use the library command to tell R which packages to load in. So, for example, if you've installed the ggplot2 library, and you want to be able to use the functions in ggplot2, you need to type in the command library(ggplot2) in order to get access to that functions in that package. All packages need to be loaded, will be loaded first, so for example if you are missing some dependancies, then you wont be able to load that package. An important note here is that you should not put the package names In quotes when you are using library otherwise you won't get correct loading. [INAUDIBLE] some packages produce messages when they are loading and some don't. Either way you don't need to worry about it. So after you load a package the functions exported by that package will be attached at the top of the search list so what you can do is you can type library(ggplot2). And then if you type search, open parentheses, close parentheses, you will see all of the functions that are part of the ggplot2 package. So the summary is that R package is a powerful mechanism for extending the functionality of our R Packages could be obtained by CRAN or other repositories. You install the packages, function could be used to install packages from the R console and then library is what you do to load the packages in to actually get access to the functions.