Skip to Main Content

Introduction to R Programming

Setting up the software environment

What makes R unique is that it has thousands of free "packages" that made by other programmers. Some of them are already imbedded in R when you install it, but else are not. 

Below, I will tell you when you will need to install new packages, which one to install, and how to use it.

1. For example, you want to use the function "kurtosis()", but you have the error below. That's when you need to install new packages

2. Run the selected lines. The code can be found above. This code is programmed by stevenworthington, which can also be found on https://gist.github.com/stevenworthington/3178163

3. After running the lines, select the "USA (CA 1) [https]"

4. As you can see we installed 6 packages respectively named "fBasic" "plyr" and so on. Also, we can now use the "kurtosis()" function

5. After the above steps, you will only need to use the "library()" funcion to install the packages. Step 1 to 4 only need to be done for once in the life time

6. If you don't know which packages to install, you can use the "help()" function or just google it!

7. If you want to install other packages, just change the name in the highlighted line