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
}

Try the ceramic package in your browser

Any scripts or data that you put into this service are public.

ceramic documentation built on April 22, 2023, 1:12 a.m.