1.1 Download and Install R - Video Tutorials & Practice Problems
Video duration:
6m
Play a video:
Video transcript
<v Voiceover>The first</v> thing to do in order to use R we have to go to our browser and download it. So we'll go into Chrome and we'll R's website which is r-project.org. This takes you up to a website that does indeed look like it's from the early 90's, but it has everything we need right in there. So in order to download R, there's all sorts of information up here that has everything we need. Stuff about the contributors to R, screenshots, little explanation about R, but what we really care about right now is just downloading the installer. So for that, we come to CRAN which stands for the Comprehensive R Archive Network. We come here and we see these CRAN mirrors. These are basically computers around the world that let you download R from the nearest location. It's a way of making things run a little more smoothly. So situated here in New York, the closest place we have is the Carnegie Mellon Statlib. You come here, click on that, and it takes us to the mirror at Carnegie Mellon. And this brings up a few possibilities for downloading. The first option is through Linux, then Mac and Windows. Choose operating system you're using. For Windows and Mac OS it's roughly the same, but for Linux you can use it from the command line using apt-get for instance, if you're on Ubuntu. I'm using a Windows machine, so I'll come and click Download R for Windows. And here you have even more options. Rtools is necessary if you're gonna be building your own package using C++. We don't need to worry about that for now. And we have the contrib build here, but again, that's more than we need to get started. All we need is base. So we'll go ahead and click on base, which will bring us up to the screen to download the actual installer. As of the filming of this video, the most recent version of R is 3.0.1. So we will go ahead and download that. Save it anywhere in your computer. For now, I'll save it to my Desktop. And we'll just click Save and we'll begin downloading. This is 52 megabytes, so depending on your internet speed, it will take varying amounts of time. So now that it's down downloading, we will go to our Desktop. Just like any other installer, we can run this just by double-clicking, but due to some administrative issues, we want to right-click and click Run As Administrator. This will give the installer more permissions to set up more files where they are needed. So I'll click Run As Administrator. The first question it asks is what language would you like to install it in? The default is English, but we have many other languages. We'll go ahead and use English and click OK. First screen it pulls up is just telling you welcome to the setup. Go ahead and click Next. And then there's the license. This is free and open-source software, but there is still legal information here and you might want to peruse this. It is under the GNU General Public License and there's lots of information about what you can do. I will leave you on your own to read this. So go ahead and click Next. Now here's where you really have to pay attention. The R core team is very specific in that R should be installed in a folder with no spaces in the name. Even though half the time the default they give you is in program files which has a space. So we should choose a different folder. So you can go ahead and click Browse and find another folder. Now, I personally like using the Documents folder. So on Windows 7 that is under Users, then your name, and then you scroll down to see My Documents. Now, it might look like there's a space in the name My Documents, but that's just the front-facing name. Underneath it there's no space and I'll show that in a little bit. So since I had many versions of R running, I like having within Documents, another folder called R. And right in here, you can see I have many versions installed from 2.13, 2.14, 2.15, and 3.0.0. So I'll click on R. So we can go ahead and install 3.0.1. So when I click OK, we can see that actually, it's called Documents not My Documents. So we're good, no spaces in the path now. So we can click Next and now we're given more options. The core files and message translations you want to leave. The only real decision you have is whether to install 32-bit, 64-bit or both. This used to matter a lot more back when not all processors were 64-bit processors and when you have a 64-bit processor, you can store more data and work on larger data. And since big data is so popular right now, you're going to want to use 64-bit. The option whether to keep 32-bit is if you might need it for some legacy software or for some other reason. Doesn't really make a difference, but you definitely want 64-bit. So make sure that's checked and come click Next. Now, there are all sorts of options you can specify. But since we will be using Our Studio as a front-end, we're gonna go ahead and just set the defaults and not worry about any of those. So after you click Next, it gives you the option of creating a Start menu folder. Might as well keep it, click Next. I personally don't want a desktop icon, so I'm gonna get rid of it. I do like the idea of saving the version number in the registry and associating R with .RData files which we will learn about in a later chapter. So clicking Next begins the installation process. It's a fairly quick process depending on the type of computer you have and this gets everything you need to use R. When the installation is finished, it tells you it's done and we can click Finish. Now that is installed, we can go ahead and see what R is like. Come to Start. And it's already there for us. This is the 32-bit version. So we will go to All Programs, scroll down until we see R, and then we will choose R x64 3.0.1. This is the 64-bit version. Launching that brings up a very old-fashioned looking console where you can do your work. Now this is the way most people used R up until only a few years ago until R Studio was released by J.J. Allaire and his company. That's what we will be using for the rest of the class. This way you could see what life was like before R Studio came around.