In this activity we’ll explore a small data set on polar bears from Skandinavisk Dyrepark. The data includes weights of 8 polar bears across years - 4 males and 4 females (2 cubs born in autumn/winter 2021). One male and one female only have one weight. And the cubs have a limited number of weights due to their age and have not yet reach adult weight.
We begin by loading some packages
library("readxl")library("dplyr")
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library("stringr")library("janitor")
Attaching package: 'janitor'
The following objects are masked from 'package:stats':
chisq.test, fisher.test
Warning: There was 1 warning in `summarise()`.
ℹ In argument: `max_weight = max(weight, na.rm = TRUE)`.
ℹ In group 3: `sex = NA`.
Caused by warning in `max()`:
! no non-missing arguments to max; returning -Inf
# A tibble: 3 × 3
sex max_weight mean_weight
<chr> <dbl> <dbl>
1 female 371 195.
2 male 691 533.
3 <NA> -Inf NaN
NoteQuestion
How many weight observations do we have for each polar bear?