R Bootcamp - Day 3 - Exercises

Author

Jay Hesselberth

Published

October 21, 2024

Today’s datasets - Exercise 1

Explore these data sets:

arrange - Exercise 2

filter - Exercise 3

filter by membership

# filter based on skin color

Conditions can be combined using & (and), | (or).

# filter on skin and eye color

select - Exercise 4

mutate (& pipe |>)- Exercise 5

# create a new column to display height in meters

# using the pipe to feed data into multiple functions sequentially

# mutate allows you to refer to columns that you’ve just created

# output needs to be saved into a new dataframe since dplyr does not "change" the original dataframe

# using if_else clauses with mutate

rowwise operations (if time permits)

# let's input data (same one used in yesterday's problem set)
# data <- read_csv(file = "data/data_transcript_exp_subset.csv")

# calculate mean for each time point using mutate in a rowwise fashion!

summarise - Exercise 6

group_by + summarize - Exercise 7