Data Modification
Welcome to our module about data modification. Data rarely arrive in a perfect, ready-to-analyze form. Instead, they must be filtered, sorted, and transformed so that patterns become visible and variables take on meaningful structure.
Each tutorial will comprise a series of interactive lessons with practice problems embedded throughout.
Learning Goals
After completing this module, you will be able to:
Subsetting Data
- Extract specific rows, columns, and elements from datasets using Base R and
dplyr. - Apply logical conditions to filter data efficiently.
- Use tools like
filter()andselect()to subset data clearly and reproducibly.
Sorting Data
- Reorder values or rows in ascending or descending order.
- Use
dplyr::arrange()to sort data frames by one or more variables.
Transforming Data
- Convert variables into factors with defined levels.
- Create, modify, and standardize variables using
mutate(). - Apply operations across multiple columns with
across(). - Build new variables conditionally using
case_when(). - Rename variables programmatically using
rename()andrename_with().
Click the button below to get started with the first tutorial.