add_cog_group: Add a cognostic group

Description Usage Arguments Examples

View source: R/add_cog_group.R

Description

Add a new cognostic to be used when calculating automatic cognostics.

Usage

1
add_cog_group(name, fields, description = NA, fn, ...)

Arguments

name

Name of cognostic group

fields

data.frame of 'dimension' and 'type' columns. dplyr::bind_rows() of field_info outputs for convenience

description

Description of cognostic group

fn

function to calculate a cognostic group. May return a named list or a single row tibble. Each value of the return data should be the output of cog_desc

...

ignored

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
add_cog_group(
  "univariate_continuous",
  field_info("x", "continuous"),
  "univariate metrics for continuous data",
  function(x, ...) {
    x_range <- range(x, na.rm = TRUE)
    list(
      min = cog_desc(x_range[1], "minimum of non NA data"),
      max = cog_desc(x_range[2], "maximum of non NA data"),
      mean = cog_desc(mean(x, na.rm = TRUE), "mean of non NA data"),
      median = cog_desc(median(x, na.rm = TRUE), "median of non NA data"),
      var = cog_desc(var(x, na.rm = TRUE), "variance of non NA data")
    )
  }
)

## End(Not run)

schloerke/autocog documentation built on June 26, 2018, 3:21 p.m.