library(tidyverse)
rr <- tribble(
~Station, ~Sp1, ~Sp2, ~Sp3, ~Sp4,
"A1", 1, 5, 6, 4,
"A2", 3, 2, 6, 1,
"A3", 7, 0, 1, 3,
"A4", 0, 5, 6, 7,
"A5", 1, 0, 6, 0,
"A6", 0, 0, 4, 2,
"A7", 8, 2, 1, 7,
"A8", 0, 11, 1, 17,
"A9", 5, 2, 9, 7
)
(rr2 <- rr |>
summarise(across(where(is.numeric),
sum)) |>
pivot_longer(cols = everything()) |>
arrange(desc(value)))
slice_head(rr2,n=2)