STAT 20: Introduction to Probability and Statistics
The "dplyr"
package in R is a fundamental tool for data manipulation, forming a core component of the tidyverse suite of packages.
It provides a consistent set of “verbs” or functions designed to simplify common data wrangling tasks with data frames and tibbles (an enhanced data frame structure).
slice()
select()
filter()
mutate()
arrange()
summarize()
group_by()
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
slice()
Isolates particular rows of a data frame by row number.
slice()
Isolates particular rows of a data frame by row number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
slice()
Isolates particular rows of a data frame by row number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
select()
Selects variables by name or number.
select()
Selects variables by name or number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
select()
Selects variables by name or number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
select()
Selects variables by name or number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
select()
Selects variables by name or number.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
filter()
Returns rows that meet certain criteria.
filter()
Returns rows that meet certain criteria.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
filter()
Returns rows that meet certain criteria.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
filter()
Returns rows that meet certain criteria.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
mutate()
Updates an existing variable, or adds a new variable that can be a function of previous variables.
mutate()
Updates an existing variable, or adds a new variable that can be a function of previous variables.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
arrange()
Sort the rows of a data frame by the values of variables.
arrange()
Sort the rows of a data frame by the values of variables.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
arrange()
Sort the rows of a data frame by the values of variables.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
arrange()
Sort the rows of a data frame by the values of variables.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
summarize()
Summarize a variable with a statistic.
summarize()
Summarize a variable with a statistic.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55
summarize()
Summarize a variable with a statistic.
name house height spells
1 Harry Gryffindor 1.78 60
2 Bellatrix Slytherin 1.57 75
3 Hermione Gryffindor 1.65 70
4 Draco Slytherin 1.75 55