Lesson 1: Intro to R
Episode 2: Data Structures
Videos Credits: Claudiu Forgaci (Introduction), Javier San Millán Tejedor, Aleksandra Wilczynska
In this episode you’re going to start learning about the data structures such as Vectors in the R environment.
Vectors
Here the data vectors are explained.
Character Vectors
Here the character vectors are explained.
Str Vectors
str() function is explained.
Question about str function
What does structure function do?
Answer to the question
Combining Vectors
The combine function, c(), is introduced here.
Tip: Mixed Vectors
Tip on Mixed Vectors and str()
Additional tips on the Mixed Vectors
Question about mixed vectors
What is the underlying rule behind it?
Logical Values
Vectors can also have logical values.
Question about mixing values
What happens when we mix two different types of values?
Missing Values
There will be missing values.
Challenge: Missing Values
Missing Values Part 3
Factors
Creating Factors
Here’s how to create factors.
Inspect Factors
The levels() function is introduced.
Tip: Summary function
A tip on using the summary() function
Reorder levels
fct_relevel() function is explained.
Questions regarding the syntax
Question about exclamation mark
What is the use of an exclamation mark inside the syntax?
Is it okay to have whitespaces or new lines in R programming?
Episode 3: Exploring Data Frames & Data Frame Manipulation with dplyr
Check the information of data frame basics and explore the dataset.
The dollar sign
See how to use the dollar sign ($) in your script.
Question about factor function
Can we use factor function to convert character vector?
Answer
Tip: Intro to ncol & nrow
An introduction to ncol and nrow functions.
Question about summaries
Can we get the summaries for all countries?
Dataframe manipulation with dplyr
Select function
Tip: select function errors
When choosing the select function, you may face error saying tidyverse is not installed.
Pipes
Tip: read indentations when using pipes
A tip when you’re using pipes is to read your code with indentations.
Question about the pipe
Why use a pipe instead of doing things step by step?
Filter
Question about the order operation
What is the order of operation if we write it based on that structure?
A follow-up question from the previous question
Challenge: Filtered data frame
Challenge description
Challenge solution
You can also check the alternative solution
Question about the challenge
how to get all info about a country?
Group and summarize
Check the detailed descriptions from the carpentries regarding group and summarize with a challenge.
Multiple groups and summary variables
Frequencies
Mutate
Data Visualization
Introduction to data visualization
Don’t forget to take a quick look at the cheatsheet
Second part of the data visualization
Third part of the data visualization. Creating a summary plot for the data using the mutate function.
Question about a continent in the dataset
How did we know there’s the continent of America in the dataset?
fourth part of data visualization, coloring.
Color scale
Color scale and viridis function
Writing data
Saving the data
write.csv function description.
Also, check the cheatsheet.