R/subsetRoadsSamples.R

Defines functions subsetRoadsSamples

Documented in subsetRoadsSamples

#' Sample for road segment endpoints.
#'
#' For endpoints with 1 or 3 intersections.
#' @export

subsetRoadsSamples <- function() {
  framework <- cholera::roads[cholera::roads$name != "Map Frame", ]
  dat <- framework
  dat$point.id <- paste0(dat$x, "-", dat$y)
  intersections <- table(dat$point.id)
  # > table(intersections)
  # intersections
  #   1   2   3   4
  # 276  10 221  44
  one <- intersections[intersections == 1]
  three <- intersections[intersections == 3]
  list(one = sample(names(one)), three = sample(names(three)))
}

# usethis::use_data(rd.sample, overwrite = TRUE)

Try the cholera package in your browser

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

cholera documentation built on March 7, 2023, 5:31 p.m.