# Introduction to R Programming

6

Lessons87

Quizzes6

Assignments35

Course description

R is one of the best programming languages specifically designed for statistics and graphics. Programming in R is a fast and effective way to perform advanced data analyses and manipulations. In this course, you will learn how to use R and utilize the many data analysis techniques, methods, and functions it has to offer to the professional data scientist.## Introduction & Getting Started

In this introductory part of the course, we will go for a walk in the R environment. First, we are going to install R and RStudio together. Then, we’ll dive straight into RStudio and learn about its interface, and how to make use of the main windows and tabs there. We will also talk about setting your working directory and getting additional help.

## The building blocks of R

In this section, you will learn about objects and coercion rules in R, functions in R, and how to use R’s console. Not only that, but by the end of the section, you will have built your first function; it will be able to draw cards from a deck, so you can play your favorite board game even if you don’t have the physical cards in front of you.

## Vectors and vector operations

Now that we have covered the basics, in this section, we are about to drill deeper into R’s most widely used object type – the vector. You will learn how to create vectors and how to perform vector arithmetic operations. You will also see how to index and access elements from a vector, and how vectors recycle. Then, you will see how to change the dimensions of a vector and create a two-dimensional object from it. That will be our nice little segue into matrices.

## Matrices

In this section, you will learn how to create and rename matrices, and how to index and slice matrices. All of this will lay a super solid foundation for the big star of data analysis: the data frame. Not only that, but we will also talk about factors, which are related to the statistics part of the course. Finally, we will cover lists: R’s way of storing hierarchical data.

## Fundamentals Of Programming With R

In this section of the course, we will go through some of the fundamental tools you need to learn when programming with R (and many other programming languages). We will cover relational operators, logical operators, vectors, IF, ELSE, and different types of loops (for, while, and repeat) in R. Some of these topics will have already been introduced to you in our Python training, but here you will have the chance to reinforce what you have learned and see things with R in mind.

## Data frames in R

In this section, we will focus our attention on how to create and import data frames into R. How to quickly get a sense of your data frame by using the str() function, summary(), col-and row-names, and so on. We’ll learn about accessing individual elements of your data frame for further use. And about extending a data frame with either new observations or variables (or row and columns). Furthermore, we will talk about dealing with missing data because in real life that happens more often than we’d like. And we’ll discuss exporting data frames once we’re happy with their general state and are ready to share them with the world.

## Manipulating data with R

Here, we will be talking about data transformation with the dplyr package. More specifically, how to filter(), arrange(), mutate(), and transmute() your data, as well as how to sample() fractions and a fixed number of elements from it. You will also learn what tidy data is, why it is extremely important for the efficiency of your work to tidy your data sets in the most meaningful way, and how to achieve this by using the tidyr package. You will be tidying several messy real-life data sets, and you will learn how to combine multiple operations in an intuitive way by using the pipe operator.

## Visualizing data with R

Plotting and graphing data is the most elegant way to understand your data and present your findings to others. In this section, we are going to learn about the grammar of graphics and the seven layers that comprise a visualization. Then, we will jump straight into creating graphs and plots, with the ggplot2 package. Starting with the histogram, we will continue on to the bar chart, then onto the box and whiskers plot, and finally, the scatterplot. You will notice that with each new type of plot, you will also be learning about a new layer or two while getting familiarized with ggplot2 and its inner workings in an incremental way.

## Exploratory data analysis with R

In this part of the course, we start applying R for statistical analysis. We are ready to discuss several exploratory data analysis topics: population vs. sample; mean, median, and mode; skewness; variance, standard deviation, and the coefficient of variability; and covariance and correlation.

## Hypothesis Testing

At this point, you are already familiar with hypothesis testing. We covered it in one of our earlier modules – Statistics. What we will do here is a natural continuation – you will learn how to carry out hypothesis testing in R.

## Linear Regression Analysis in R

Regression analysis is another topic we covered earlier in our program. As with hypothesis testing, this is a great opportunity to apply the theory you have learned previously in R.