I am unable to run the following on RStudio penguins %>% group_by(island) %>% drop_na(.) %>% summarise(mean_bill_length_mm = mean(bill_length_mm)) The error coming up is Error in drop_na(.) : could not find function "drop_na" What do I have to do to fix this?
You can use this code:
library(palmerpenguins)
library(tidyverse)
penguins %>% group_by(island) %>% drop_na(.) %>% summarise(mean_bill_length_mm = mean(bill_length_mm))
Output:
# A tibble: 3 × 2
island mean_bill_length_mm
<fct> <dbl>
1 Biscoe 45.2
2 Dream 44.2
3 Torgersen 39.0