For each location, compute the average of the statistic calculated for each space-time window that the location is included in, i.e. average the statistic over both zones and the maximum duration.
Value
A data.table
with the following columns:
- location
The locations (as integers).
- total_score
For each location, the sum of all window statistics that the location appears in.
- n_zones
The number of spatial zones that the location appears in.
- score
The total score divided by the number of zones and the maximum duration.
- relative_score
The score divided by the maximum score.
Examples
if (FALSE) {
# Simple example
set.seed(1)
table <- data.frame(zone = 1:5, duration = 1, score = 5:1)
zones <- list(1:2, 1:3, 2:5, 4:5, c(1, 5))
x <- list(table = table, n_locations = 5, max_duration = 1, n_zones = 5)
score_locations(x, zones)
}