... dplyr verbs: mutate


Once again we assume that you've got the dataframe set up appropriately.


# This command makes sure that the chickweight dataframe is clean.
df <- ChickWeight %>% ungroup() %>% as.data.frame()

You can combine verbs together. Below we're using filter and mutate.

df %>%
  filter(Diet == 3) %>%
  mutate(growth = weight/(Time + 1))

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider signing up for the newsletter.