Today, we’ll dive into R programming and ensure that you feel comfortable with the basics. Then, you’ll work in teams to finalize your research question(s) and your plan for variable operationalizations.
In some of the examples we’ll use in class, you will import data from an R package rather than loading it from your files.
Rows: 344
Columns: 8
$ species <fct> Adelie, Adelie, Adelie, Adelie, Adelie, Adelie, Adel…
$ island <fct> Torgersen, Torgersen, Torgersen, Torgersen, Torgerse…
$ bill_length_mm <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, …
$ bill_depth_mm <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, …
$ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186…
$ body_mass_g <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, …
$ sex <fct> male, female, female, NA, female, male, female, male…
$ year <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007…
myownpenguins %>%
group_by(species) %>%
summarize(mean.bodymass = mean(body_mass_g, na.rm = TRUE),
sd.bodymass = sd(body_mass_g, na.rm = TRUE),
totalnumber = n())
# A tibble: 3 × 4
species mean.bodymass sd.bodymass totalnumber
<fct> <dbl> <dbl> <int>
1 Adelie 3701. 459. 152
2 Chinstrap 3733. 384. 68
3 Gentoo 5076. 504. 124