Hi there, I need some help with counting/filtering missing values as a group.
I have firstly done this section, which works as intended:
rodents_seasons <- rodents_full %>%
mutate(season_name = case_when(
month == 1 | month == 2 | month == 12 ~ "Winter",
month == 3 | month == 4 | month == 5 ~ "Spring",
month == 6 | month == 7 | month == 8 ~ "Summer",
month == 9 | month == 10 | month == 11 ~ "Autumn",
TRUE ~ NA_character_
)) %>%
select(-month) %>%
select(record_id, day, year, season_name, plot_id, species_id, sex, hindfoot_length, weight, genus, species, taxa, plot_type)
rodents_seasons
The problem I am having is with this next section:
rodents_seasons %>%
filter(is.na(hindfoot_length) | is.na(weight) | is.na(sex)) %>%
count(season_name, sort= TRUE)
As it is not counting the missing values correctly. I want to be able to count how much missing data there is for each season.
Thank you for any help.