db_functions {segmetric}R Documentation

Database of metrics functions

Description

These functions are used to register new metrics in the segmetric database.

Usage

.db_list()

.db_set(key, value)

.db_del(key)

.db_get(key)

sm_list_metrics()

sm_new_metric(
  fn,
  fn_subset,
  name = "",
  optimal = 0,
  summarizable = TRUE,
  description = "",
  reference = ""
)

sm_reg_metric(metric_id, entry)

sm_unreg_metric(metric_id)

sm_desc_metric(metric_id)

Arguments

fn

A function that receives a segmetric object and returns the metric values.

fn_subset

A function that returns a subset.

name

A character containing the metric name (Defaults to "").

description

A character containing a description of the metric (Defaults to "").

reference

A character with the reference to a scientific literature describing the metric.

metric_id

A character value containing a unique metric identification.

entry

A metric_entry object returned by new_metric() function.

Value

Examples

sm_reg_metric(
    metric_id = "Example",
    entry = sm_new_metric(
        fn = function(m, ...) {
            sm_area(sm_ytilde(m)) / 
                sm_area(sm_ref(m), order = sm_ytilde(m))
        },
        fn_subset = sm_ytilde,
        name = "Metric name example",
        description = paste("Values range from A to B.",
                            "Optimal value is C"),
        reference = "Author (Year)"
    ))

sm_desc_metric("Example")
sm_list_metrics()


[Package segmetric version 0.3.0 Index]