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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.