Course

A Beginner's Introduction to R Through the Tidyverse

Learn the basics of R and the Tidyverse

Course Sections

Welcome

Welcome to the course!

R is a free and open-source programming language that is popular in the field of data analytics. Learning R is a great way to work with data.

Each section in this course has a set of examples, exercises, and quizzes to help you learn.

Course Outline

In this course, you'll learn how to:

  • Select columns
  • Visualize data
  • Filter rows
  • Summarize and group data
  • Create columns

Let’s get started!

What is R?

R is a programming language popular among data analysis, social scientists, and computer programmers. It is software program that you run by typing code.

What is the Tidyverse?

People extend R by bundling code they wrote into packages. Tidyverse is a set of R packages that help simplify common data tasks.

Your first line of code

The following code is interactive. You can run the code by clicking the run button. The code will print “Hello World!” in the console.

hello world
Exercise 1.1

It’s your turn now. Type print("Hello World!") in the code editor below and click the run button.

hello world

Congratulations! You’ve written your first line of code in R.

Exploring an Example dataset

In this course, we’ll create a simple dataset and use it to learn R and the Tidyverse. This is a dataset of flowers with their names, height (centimeters), season, sunlight (hours), and growth rate.

nameheightseasonsunlightgrowth
Poppy75Spring8.3fast
Rose150Summer6.4slow
Zinnia60Summer8.7fast
Peony90Spring7.2slow

To create a dataframe, we can use the data.frame() function.

 flowers <- data.frame(
  name = c("Poppy", "Rose", "Zinnia", "Peony"),
  height = c(75, 150, 60, 90),
  season = c("Spring", "Summer", "Summer", "Spring"),
  sunlight = c(8.3, 6.4, 8.7, 7.2),
  growth = c("fast", "slow", "fast", "slow")
)
 
flowers 
Exercise 1.2

Try running the following code.

flowers

Installing and loading the tidyverse package

To install the tidyverse package, we need to run this code. You only need to do this once on your computer.

 install.packages("tidyverse") 

Now, whenever you are using R and need to use the tidyverse, make sure to load the package by adding this line in the beginning and running it.

 library(tidyverse) 

Review

We made it through the first section! We learned how to print “Hello World!” in the console, create a simple dataset, and install and load the tidyverse package.

Self-assessment

    Loading...

    Loading...

summary We've learned how to
  • Print “Hello World!” in the console
  • Create a simple dataset
  • Install and load the tidyverse package