Join Conrad Carlberg for an in-depth discussion in this video Install DescTools in R, part of R for Excel Users.
- [Voiceover] One of the literally hundreds of contributed packages that are available to you in R is named DescTools. And I'm going to show you how to download it and install it into R in this lesson. One of reasons that DescTools is such a valuable contributed package, is that it includes many standard and rather simple statistical tests and statistical analyses that you might want to run before you submitted your data to a more sophisticated analysis, such as multiple regression or the analysis of variance.
Prior to DescTools, these more elementary analyses were available only by going to a variety of other contributed packages. So that you would find a package that would do a box-and-whiskers plot for you, for example. And then if you wanted to find the means and standard deviations of the variables that you were interested in then you'd have to open a different package. DescTools brings them all together into just one package so that you can get virtually all of those analyses running through the data one time only.
A big time saver. Here's how we go about downloading and installing it. The process starts with the Packages menu. So you'll select it. You come down to the Install packages item in that menu. The first thing that R wants to know is where you want to download it from. What I like to do is click HTTP mirrors at the bottom of that list box and then click OK. And then I've got all these mirror sites that I can use. I scroll down to USA CA 1 because I'm downloading this to a computer that's in California.
So that's convenient. And once I've chosen that, I click OK. At this point, R wants to know which package you want to download. Now that we've established where we're going to download it from, we need to find DescTools in this list of packages. Again, there are hundreds of them so it can take awhile to locate the one that you're interested in. But it is in alphabetical order and so it's doable. We're looking for D-e-s-c-T-o-o-l-s and there it is. You might want to make a note of exactly how that's spelled and also the case in which the letters are given.
Capital D, lowercase esc, capital T, ools. We're going to need to enter that from the keyboard shortly. Once that's chosen, just click OK and then R takes over and downloads the file to the computer, unpacks the zip file and makes it available to us. So with DescTools now available, rather downloaded, we can make it available to R with another command. And that's the library command. This is similar to installing an add-in in Excel.
I'm going to type library and then open parentheses, and DescTools, close parentheses. Before I hit enter, I want to draw your attention once again to the case of each of these letters. The library command is part of the base R functionality and is intended to be typed in all lowercase. DescTools as a contributed package, the name of it is up to the person who contributed it. That person chose to make the D and T uppercase and the remainder of the letters in lowercase.
So, you'll need to type it in exactly this fashion. If you type it, for example, all in lowercase then R is going to complain to you that it can't find that package. But this is typed correctly and so we just hit enter and in this run and in subsequent runs of R we've already downloaded the contributed package, it's already available on the computer. All you need to do to draw R's attention to it is you enter the library open brand DescTools command. We'll show you more about how to go about using DescTools in the next lesson.
Much of the course focuses on how crucial statistical tasks and operations are done in R—often with the DescTools package—as contrasted with Excel's functions and Data Analysis add-in, and then scales up from there, showing R's more powerful features. Conrad Carlberg will help you effectively toggle between both programs, moving data back and forth so you can get the best of both worlds. Start by learning how to install R and the DescTools package, and the data files used in all the hands-on exercises. Then learn about calculating descriptive statistics on numeric and nominal variables, and running bivariate analyses in both Excel and R. In the "Next steps" video, Conrad breaks down the pros and cons of Excel vs. R and provides tips for learning more about statistics in each application.
- Installing R and DescTools
- Descriptive statistics in Excel and DescTools
- Moving data between R and Excel
- Running the Desc function
- Bivariate analysis in R and Excel