getenum2: Extract counts from one or more enumerations

View source: R/verisr.R

getenum2R Documentation

Extract counts from one or more enumerations

Description

When exploring VERIS data, you may want to get a simple count of the values within a value or enumeration. Given one or more enumerations, this will return the subsequent underlying logical values in an ordered data frame. The data frame should be formatted for use in ggplot2 graphics.

Usage

getenum2(
  veris,
  enum,
  primary = NULL,
  secondary = NULL,
  filter = NULL,
  add.n = T,
  add.freq = T,
  fillzero = T,
  exclusive = F
)

Arguments

veris

a verisr object

enum

the main enumeration field

primary

the primary enumeration to filter on

secondary

the (optional) secondary enumeration to filter on

filter

limit what records are searched (optional)

add.n

include a total count of variables found (denominator)

add.freq

include a percentage (x/n)

fillzero

fill in missing matches with zeros

exclusive

logical value, If true, will count the unknown value only if it exclusive and it will not count the Unknown if it is selected with other attributes in the enumeration.

Details

As of version 1.1: the enum variable may be a vector of one or more enumerations. This enables any number of dimensions to be specified. This makes the primary and secondary obsolete but are still supported for the time being.

Note there are some special values that can be set as the enumeration, that may not be obvious. : * actor, action, attribute: will all return the next level down. For example, just querying for "action" will return "malware", "hacking", and so on. * action.variety: will return the variety enumerations across all actions (e.g. top N actions) (not in getenumby() yet) * asset.variety: will return the type of assets, "Server", "Network, "User Dev" and so on * victim.industry2: will return a short label of industries based on 2 values of NAICS code. * victim.industry3: will return a short label of industries based on 3 values of NAICS code. * pattern: will return the pattern the incidents are in.

Change in 1.1: the "add.n" and "add.freq" options are now TRUE by default. #' @aliases getenumby

Examples

## Not run: 
# old method:
a2 <- getenum(veris, "action", primary="asset.variety")
# new method:
a4 <- getenum(veris, c("action", "asset.variety", "actor", "attribute"))

## End(Not run)

vz-risk/verisr documentation built on Aug. 5, 2023, 4:34 a.m.