diff --git a/R/jitter.R b/R/jitter.R index 3beef29..f4b2ef3 100644 --- a/R/jitter.R +++ b/R/jitter.R @@ -62,11 +62,20 @@ #' # plot(od_sf[od$all > 200, 1]) #' # plot(dlr3[od$all > 200, 1]) #' # mapview::mapview(od_sf$geometry[od$all > 200]) -od_jitter = function(od, - z, - zd = NULL, - subpoints_o = NULL, - subpoints_d = NULL) { +od_jitter = function( + od, + z, + zd = NULL, + subpoints = NULL, + code_append = "_ag", + population_column = 3, + max_per_od = 5, + keep_ids = TRUE, + integer_outputs = FALSE, + # od_jitter-specific arguments (and zd) + subpoints_o = NULL, + subpoints_d = NULL + ) { if (!methods::is(od, "sf")) { # the data structure to reproduce for matching OD pairs od = od::od_to_sf(od, z = z, zd = zd) @@ -75,7 +84,6 @@ od_jitter = function(od, od = sf::st_drop_geometry(od) odc_df = data.frame(o = od[[1]], d = od[[2]], odc_original) z_geo = sf::st_geometry(z) - # browser() id_origins = od[[1]] points_per_zone = data.frame(table(id_origins)) names(points_per_zone)[1] = names(z)[1] diff --git a/man/od_jitter.Rd b/man/od_jitter.Rd index 99ffafa..d6410f1 100644 --- a/man/od_jitter.Rd +++ b/man/od_jitter.Rd @@ -4,7 +4,19 @@ \alias{od_jitter} \title{Move desire line end points within zone to avoid all trips going to a single centroid} \usage{ -od_jitter(od, z, zd = NULL, subpoints_o = NULL, subpoints_d = NULL) +od_jitter( + od, + z, + zd = NULL, + subpoints = NULL, + code_append = "_ag", + population_column = 3, + max_per_od = 5, + keep_ids = TRUE, + integer_outputs = FALSE, + subpoints_o = NULL, + subpoints_d = NULL +) } \arguments{ \item{od}{An origin-destination data frame} @@ -13,6 +25,24 @@ od_jitter(od, z, zd = NULL, subpoints_o = NULL, subpoints_d = NULL) \item{zd}{Zones with ids matching the destination codes in input OD data} +\item{subpoints}{Points, lines or polygons within the zones. +These define the OD data start/end points.} + +\item{code_append}{The name of the column containing aggregate zone names} + +\item{population_column}{The column containing the total population (if it exists)} + +\item{max_per_od}{Maximum flow in the population_column to assign per OD pair. +This only comes into effect if there are enough subpoints to choose from.} + +\item{keep_ids}{Should the origin and destination ids be kept? +\code{TRUE} by default, meaning 2 extra columns are appended, with the +names \code{o_agg} and \code{d_agg} containing IDs from the original OD data.} + +\item{integer_outputs}{Should integer outputs be returned? \code{FALSE} by default. +Note: there is a known issue when integer results are generated. See +https://github.com/ITSLeeds/od/issues/31 for details.} + \item{subpoints_o}{Points within origin zones representing possible destinations} \item{subpoints_d}{Points within destination zones representing possible destinations}