R/k_functions_sf.R
cross_kfunctions.mc.Rd
Calculate the cross k and g functions for a set of points on a network with multicore support. (maturing)
cross_kfunctions.mc(
lines,
pointsA,
pointsB,
start,
end,
step,
width,
nsim,
conf_int = 0.05,
digits = 2,
tol = 0.1,
resolution = NULL,
agg = NULL,
verbose = TRUE,
return_sims = FALSE
)
A feature collection of linestrings representing the underlying network. The geometries must be simple Linestrings (may crash if some geometries are invalid) without MultiLineSring
A feature collection of points representing the points to which the distances are calculated.
A feature collection of points representing the points from which the distances are calculated.
A double, the lowest distance used to evaluate the k and g functions
A double, the highest distance used to evaluate the k and g functions
A double, the step between two evaluations of the k and g function. start, end and step are used to create a vector of distances with the function seq
The width of each donut for the g-function. Half of the width is applied on both sides of the considered distance
An integer indicating the number of Monte Carlo simulations to perform for inference
A double indicating the width confidence interval (default = 0.05) calculated on the Monte Carlo simulations
An integer indicating the number of digits to retain from the spatial coordinates
When adding the points to the network, specify the minimum distance between these points and the lines' extremities. When points are closer, they are added at the extremity of the lines
When simulating random points on the network, selecting a resolution will reduce greatly the calculation time. When resolution is null the random points can occur everywhere on the graph. If a value is specified, the edges are split according to this value and the random points can only be vertices on the new network
A double indicating if the events must be aggregated within a distance. If NULL, the events are aggregated only by rounding the coordinates
A Boolean indicating if progress messages should be displayed
a boolean indicating if the simulated k and g values must also be returned as matrices
A list with the following values :
A ggplot2 object representing the values of the cross k-function
A ggplot2 object representing the values of the cross g-function
A DataFrame with the values used to build the plots
# \donttest{
data(main_network_mtl)
data(mtl_libraries)
data(mtl_theatres)
future::plan(future::multisession(workers=1))
result <- cross_kfunctions.mc(main_network_mtl, mtl_libraries, mtl_theatres,
start = 0, end = 2500, step = 10, width = 250,
nsim = 50, conf_int = 0.05, digits = 2,
tol = 0.1, agg = NULL, verbose = TRUE)
## make sure any open connections are closed afterward
if (!inherits(future::plan(), "sequential")) future::plan(future::sequential)
# }