Learn R Programming

scanstatistics (version 1.0.1)

top_clusters: Get the top (non-overlappig) clusters.

Description

Get the top \(k\) space-time clusters according to the statistic calculated for each cluster (the maximum being the scan statistic). The default is to return the spatially non-overlapping clusters, i.e. those that do not have any locations in common.

Usage

top_clusters(x, zones, k = 5, overlapping = FALSE)

Arguments

x

An object of class scanstatistics.

zones

A list of integer vectors.

k

An integer, the number of clusters to return.

overlapping

Logical; should the top clusters be allowed to overlap in the spatial dimension? The default is FALSE.

Value

A tibble with at most \(k\) rows, with columns zone, duration, score.

Examples

Run this code
# NOT RUN {
set.seed(1)
table <- data.frame(zone = 1:5, duration = 1, score = 5:1)
zones <- list(1:2, 1:3, 2:5, c(1, 3), 4:5, c(1, 5))
top_clusters(list(table = table), zones, k = 4, overlapping = FALSE)
# }

Run the code above in your browser using DataLab