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.
It’s your turn now. Type print("Hello World!")
in the code editor below and click the run button.
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.
name | height | season | sunlight | growth |
---|---|---|---|---|
Poppy | 75 | Spring | 8.3 | fast |
Rose | 150 | Summer | 6.4 | slow |
Zinnia | 60 | Summer | 8.7 | fast |
Peony | 90 | Spring | 7.2 | slow |
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
Try running the following code.
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.
Loading...
Loading...
- Print “Hello World!” in the console
- Create a simple dataset
- Install and load the tidyverse package