segmetric_functions: General functions

segmetric_functionsR Documentation

General functions

Description

These functions manipulate segmetric objects.

  • sm_read(): Load the reference and segmentation polygons into segmetric.

  • sm_clear(): Remove the already calculated metrics from segmetric.

  • print(): Print a segmetric object.

  • plot(): Plot the reference and segmentation polygons.

  • summary(): Compute a measure of central tendency over the values of a metric.

  • sm_is_empty(): Check if a segmetric object is empty.

Usage

.segmetric_check(m)

.segmetric_env(m)

sm_read(ref_sf, seg_sf)

sm_clear(m)

## S3 method for class 'segmetric'
summary(object, weight = NULL, na_rm = TRUE, ...)

sm_is_empty(m)

## S3 method for class 'segmetric'
x[i]

Arguments

m

A segmetric object.

ref_sf

A sf object. The reference polygons.

seg_sf

A sf object. The segmentation polygons.

object

A segmetric object.

weight

Weights to summarize metrics. Accepts character options "ref", "seg", and "inter", that weights using reference, segment, and intersection areas, respectively. Also accepts a numeric vector of weights of the same length as input metrics giving the weights to be used.

na_rm

Should missing values (including NaN) be removed?

...

Additional parameters (Not implemented).

Value

  • sm_read(), sm_clear(): Return a segmetric object containing an empty list and an environment attribute to store the necessary datasets.

  • sm_is_empty(): Return a logical vector indicating if each computed metric is empty.

See Also

sm_compute()

Examples

# load sample datasets
data("sample_ref_sf", package = "segmetric")
data("sample_seg_sf", package = "segmetric")

# create segmetric object
m <- sm_read(ref_sf = sample_ref_sf, seg_sf = sample_seg_sf)

# plot geometries
plot(m)

# compute a metric
sm_compute(m, "AFI")

# summarize the metric using mean
sm_compute(m, "AFI") %>% summary()

# clear computed subsets
sm_clear(m)


segmetric documentation built on Jan. 10, 2023, 5:12 p.m.