Sam Van Horne, Ph.D.
Data scientist at the University of Delaware. I work in #rstats and SAS. Like to go birding and fly fish. Toots are my own.
Chestnut-sided Warbler! In the backyard. #birdcallout #lifer
The field guide has its song as "Pleased, Pleased, Pleased to meet you."
I asked my partner to get paprika on their way home from a work trip and I was grilled about whether I checked all the places more could be, so if they find pre-existing paprika in a half hour let this be my last word and testament
I like the new .by= option for pre-group operations in #rstats, but further operations after summarise() require the group_by() option.
# This will correctly calculate the percent
# of species on each island
df <- palmerpenguins(penguins)
df |>
group_by(species, island) |>
summarise(n=n()) |>
mutate(Pct = n / sum(n)) |>
ungroup()
# This does the percent of each island-
# species combo
df |>
summarise(n=n(), .by =c(species, island) ) |>
mutate(Pct = n / sum(n))
