Hi All,
I'm currently working on a rowwise()
tutorial (https://github.com/laderast/tidyowl) and I realized that one thing I don't understand is the behavior of mutate()
versus summarize()
in a rowwise workflow.
They seem to do something similar, except that summarize()
lets you select the outputted columns. For example:
penguins %>%
rowwise() %>%
summarize(species, island,
sum_mm = bill_length_mm + flipper_length_mm)
Will only return the species
, island
, and sum_mm
columns, but
penguins %>%
rowwise() %>%
mutate(sum_mm = bill_length_mm + flipper_length_mm)
will add the sum_mm
column to the original data.frame.
Am I missing something here, or is that the basic difference between the two in a rowwise()
workflow?
Thanks,
Ted