road_kernel: Kernel density estimation on roads

Description Usage Arguments Details Value Author(s) References Examples

View source: R/road_kernel.R

Description

Kernel density estimation on roads using the function kde2d from package MASS.

Usage

1
road_kernel (count_path, roads_path, bandw = 500, group = "all")

Arguments

count_path

Path for the .csv file with the location of the observations. The file must have three headed columns (ID, x coordinate and y coordinate) with one observation per row. The coordinates must have the same projection as the roads shapefile. The header names are indiferent but the columns position must be as described.

roads_path

Path for the .shp file with the roads

bandw

Vector of bandwidths for x and y directions. A scalar value will be taken to apply to both directions.

group

String used to subset species/groups from the observations dataframe. Can be a single string or multiple strings. For multiple strings use: c("spe1", "spe2"). By default all observations are used.

Details

Observations are snaped to closest roads prior to estimation and the resulting kernel is clipped to the road. The kernel density estimation is rescaled to [0, 1] and recoded in three categories: 1 = 0.25 to 0.50, 2 = 0.50 to 0.75, 3 = 0.75 to 1

Value

A SpatialPolygonsDataFrame object with the kernel density estimation

Author(s)

Bruno Silva

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

1
2
3
roads_path <- system.file("extdata/roads.shp", package = "roadHotspots")
count_path <- system.file("extdata/count.csv", package = "roadHotspots")
output <- road_kernel(count_path, roads_path) 

bmsasilva/roadHotspots documentation built on Feb. 3, 2022, 4:50 a.m.