Skip to contents

Summarize Local Extrema

Usage

# S3 method for class 'local_extrema'
summary(object, ...)

# S3 method for class 'summary.local_extrema'
print(x, ...)

Arguments

object

A local_extrema object from detect.local.extrema().

...

Unused.

x

A summary.local_extrema object returned by summary().

Value

summary() returns a list of class summary.local_extrema with n_extrema, extrema_type, summaries of function values, neighborhood sizes and radii, and the data frame extrema_details (labels, vertex indices, values, radii and neighborhood sizes). With no extrema, numerical summaries are NA and the data frame is empty; the type is NA for legacy empty objects without detection-type metadata. print() prints this summary and invisibly returns x unchanged.

Examples

chain <- create.graph("chain", n = 5)
extrema <- detect.local.extrema(graph.adjacency(chain), graph.lengths(chain), y = c(1, 3, 1, 2,
    0), max.radius = 1, min.neighborhood.size = 2)
summary(extrema)
#> Local Extrema Detection Summary
#> ==============================
#> 
#> Extrema type: Maximum 
#> Number of extrema found: 2 
#> 
#> Top extrema by function value:
#>   label vertex_index fn_value radius neighborhood_size
#> 1    M1            2        3      1                 3
#> 2    M2            4        2      1                 3
print(summary(extrema))
#> Local Extrema Detection Summary
#> ==============================
#> 
#> Extrema type: Maximum 
#> Number of extrema found: 2 
#> 
#> Top extrema by function value:
#>   label vertex_index fn_value radius neighborhood_size
#> 1    M1            2        3      1                 3
#> 2    M2            4        2      1                 3