1/22
Looks like no tags are added yet.
Numerical Variables
integer, numeric, and double
Categorical Variables
character and factor
Row Manipulation
filter()
arrange()
Column Manipulation
select()
rename()
mutate()
Box Plot
used for a numerical variable over categories of a categorical variable
Scatterplot
used for two numerical variables
Bar Plot
used for one categorical variable with frequency on the y-axis
Histogram
used for a numerical variable on the x-axis and frequency on the y-axis
Vector
1-dimensional object that takes values of all one type, such all numerical values
List
1-dimensional object that can take values of different types, such as numerical values AND categories
Data Frame
2-dimensional object with a certain number of rows and columns, very similar to a matrix or array
na.rm = TRUE
tells a function to ignore missing values (NA) when calculating a result
KEY DIFFERENCE BETWEEN QUARTO AND R SCRIPT
Quarto can be rendered to a pdf, R Script cannot
You need to insert a code chunk to type code in a Quarto document, whereas code is just typed plainly into R Script
You can do text, code, and output in Quarto, whereas R Script can only do code and comments with “#”
arrange()
arranges rows based on the values of a given column in ascending order
select()
selects a subset of which columns to keep in (or drop from) the dataset
rename()
renames columns
rename(new name = `old name`)
mutate()
creates a new column in a data frame or tibble
filter()
filters rows to only the ones you want
drop_na()
removes rows with missing values (NA) in the specified columns. If no columns are specified, it checks all columns.
if_else()
this is an argument commonly used inside of the “mutate()” function that sets a logical condition and sets observations equal to TRUE or FALSE
Format:
if_else(condition, if true then return…, if false then return…)
Example:
if_else(grade >= 70, "Pass", "Fail")
This means if a grade is 70 or higher, return "Pass". Otherwise, return "Fail".
group_by()
groups rows by the values in one or more columns so later operations can run separately for each group.
summarise()
calculates summary values, returning one row per group or one row for the entire dataset if ungrouped.