# NOT RUN {
eventsgpkg <- system.file("extdata", "events.gpkg", package = "spNetwork", mustWork = TRUE)
bike_accidents <- sf::st_read(eventsgpkg,layer="bike_accidents")
networkgpkg <- system.file("extdata", "networks.gpkg", package = "spNetwork", mustWork = TRUE)
mtl_network <- sf::st_read(networkgpkg,layer="mtl_network")
# converting the Date field to a numeric field (counting days)
bike_accidents$Time <- as.POSIXct(bike_accidents$Date, format = "%Y/%m/%d")
start <- as.POSIXct("2016/01/01", format = "%Y/%m/%d")
bike_accidents$Time <- difftime(bike_accidents$Time, start, units = "days")
bike_accidents$Time <- as.numeric(bike_accidents$Time)
values <- k_nt_functions(
lines = mtl_network,
points = bike_accidents,
points_time = bike_accidents$Time,
start_net = 0 ,
end_net = 2000,
step_net = 10,
width_net = 200,
start_time = 0,
end_time = 360,
step_time = 7,
width_time = 14,
nsim = 50,
conf_int = 0.05,
digits = 2,
tol = 0.1,
resolution = NULL,
agg = 15,
verbose = TRUE)
# }
Run the code above in your browser using DataLab