View source: R/temporal_kde_sf.R
tkde | R Documentation |
Calculate the Temporal kernel density estimate based on sampling points in time and events
tkde(events, w, samples, bw, kernel_name, adaptive = FALSE)
events |
A numeric vector representing the moments of occurrence of events |
w |
The weight of the events |
samples |
A numeric vector representing the moments to sample |
bw |
A float, the bandwidth to use |
kernel_name |
The name of the kernel to use |
adaptive |
Boolean |
A numeric vector with the density values at the requested timestamps
data(bike_accidents)
bike_accidents$Date <- as.POSIXct(bike_accidents$Date, format = "%Y/%m/%d")
start <- min(bike_accidents$Date)
diff <- as.integer(difftime(bike_accidents$Date , start, units = "days"))
density <- tkde(diff, rep(1,length(diff)), seq(0,max(diff),1), 2, "quartic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.