From “?top_n”
>> “Will include more rows if there are ties.”
>> “wt (Optional). The variable to use for ordering.
>> If not specified, defaults to the
>> last variable in the tbl.”
library(tidyverse)
## -- Attaching packages ---------------------- tidyverse 1.2.1 --
## v ggplot2 3.2.1 v purrr 0.3.2
## v tibble 2.1.3 v dplyr 0.8.3
## v tidyr 1.0.0 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.4.0
## -- Conflicts ------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
pdl <- "https://zenodo.org/record/3575529/files/database_rilievi_Sila_2019agosto%20-%20piedilista.csv?download=1" %>%
curl::curl() %>%
read.csv()
pdl %>%
top_n(1)
## Selecting by Note
# > pdl %>%
# + top_n(1)
# Selecting by Note
pdl %>%
top_n(2, diam_cm)
pdl %>%
top_n(2, ID_DEF)
pdl %>%
select(ID_DEF) %>%
group_by(ID_DEF) %>%
summarise(n_ties = n()) %>%
arrange(desc(ID_DEF)) %>%
head(2)