dplyr verbs logo dplyr verbs: arrange

1 2 3 4 5 6 7
Notes

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

library(tidyverse)

# 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, mutate, select and arange.

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