Learn R Programming

scanstatistics (version 1.1.1)

score_locations: Score each location over zones and duration.

Description

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.

Usage

score_locations(x, zones)

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.

Arguments

x

An object of class scanstatistic.

zones

A list of integer vectors.

Examples

Run this code
# 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(observed = table, n_locations = 5, max_duration = 1, n_zones = 5)
score_locations(x, zones)

Run the code above in your browser using DataLab