R/cities_n.R

Defines functions cities_n

cities_n <- function(n = 1L, fields = FALSE) {
  idx <- sample(dim(cities)[1L], n)
  out <- if(fields) {
    cities[idx, c("long", "lat", "name", "country.etc", "pop",  "capital")] 
  } else {
    cities[idx, c("long", "lat")] 
  }
  out
}
hypertidy/ceramic documentation built on Feb. 28, 2024, 11:27 p.m.