mmm_help: Extended Mode Properties

View source: R/mmm.R

mmm_helpR Documentation

Extended Mode Properties

Description

Extended modes are defined for non-empty atomic objects. For all other objects, the extended mode is NULL. These are not formally defined modes, but are evaluated dynamically based on the current characteristics of an object.

Atomic objects that contain only NA values are of every extended mode (they can be coerced to any mode without introducing new NA values).

Generic extended modes

  ⁠'atm', 'ATM'⁠   atomic (both a basic and an extended mode property).

Character extended modes

  ⁠'chr', 'CHR'⁠ character
  ⁠'ch1', 'CH1'⁠ onechar, or all(nchar(x) == 1)
  ⁠'ch3', 'CH3'⁠   threechar, or ⁠all(nchar(x) == 3)⁠
  ⁠'clr', 'CLR'⁠ color (valid color values)
  ⁠'str', 'STR'⁠ string (no blanks)

Categorical extended modes

  ⁠'fac', 'FAC'⁠ factor
  ⁠'lgl', 'LGL'⁠ logical
  ⁠'ord', 'ORD'⁠ ordered factor
  ⁠'uno', 'UNO'⁠   unordered factor

Basic numeric extended modes

  ⁠'num', 'NUM'⁠ numeric
  ⁠'frc', 'FRC'⁠ fractional
  ⁠'whl', 'WHL'⁠   whole number

Value-restricted numeric extended modes

  ⁠'cor', 'COR'⁠   correlation valued(-1 to 1)
  ⁠'pct', 'PCT'⁠   percentage valued(0 to 100)
  ⁠'ppn', 'PPN'⁠ proportion valued (0-1)
  ⁠'pos', 'POS'⁠ positive
  ⁠'neg', 'NEG'⁠ negative
  ⁠'nng', 'NNG'⁠ non-negative
  ⁠'nps', 'NPS'⁠ non-positive

Whole-number value-restricted extended modes

  ⁠'evn', 'EVN'⁠ even
  ⁠'odd', 'ODD'⁠ odd
  ⁠'ngw', 'NGW'⁠ negative whole
  ⁠'psw', 'PSW'⁠ positive whole
  ⁠'npw', 'NPW'⁠ non-positive whole
  ⁠'nnw', 'NNW'⁠   non-negative whole

Combination extended modes

  ⁠'ind', 'IND'⁠ indexer (see 'lgl', 'psw')
  ⁠'srt', 'SRT'⁠   sortable (see 'chr''num''ord')
  ⁠'nst', 'NST'⁠ non-sortable atomic

Usage

mmm_help()

mmm(x)

mmm_funs()

mmm_props()

is_mmm_spec(spec)

MMM(x, spec, ...)

CH1(x, ...)

CH3(x, ...)

CHR(x, ...)

CLR(x, ...)

COR(x, ...)

EVN(x, ...)

FAC(x, ...)

FRC(x, ...)

IND(x, ...)

LGL(x, ...)

NEG(x, ...)

NGW(x, ...)

NNG(x, ...)

NNW(x, ...)

NPS(x, ...)

NPW(x, ...)

NST(x, ...)

NUM(x, ...)

ODD(x, ...)

ORD(x, ...)

PCT(x, ...)

POS(x, ...)

PPN(x, ...)

PSW(x, ...)

SRT(x, ...)

STR(x, ...)

UNO(x, ...)

WHL(x, ...)

Arguments

x

An R object.

spec

NULL or a complete character vec containing one or more extended mode properties from mmm_props(). extended mode specs may be pipe-delimited. If there are multiple properties in spec, x is inspected for a match to any of the specified properties.

...

Arguments passed on to meets

Functions

  • mmm(): Lists all extended mode properties possessed by x. Returns a character vector.

  • mmm_funs(): Lists all extended-mode checking functions. Returns a sorted, uppercase, character vector.

  • mmm_props(): Lists all extended-mode properties. Returns a sorted, lowercase, character vector.

  • is_mmm_spec(): Checks whether a spec is an extended-mode property spec. Returns a logical scalar. See ppp for a definition of a property spec.

  • MMM(): Checks whether the object x is a match to extended mode spec in spec subject to any count or value restriction arguments in .... Returns a logical scalar. See ppp for a definition of a property spec.

  • CH1(): Checks whether x is a onechar vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • CH3(): Checks whether x is a threechar vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • CHR(): Checks whether x is a character vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • CLR(): Checks whether x is a color character vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • COR(): Checks whether x is a correlation-valued vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • EVN(): Checks whether x is an even, whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • FAC(): Checks whether x is a factor vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • FRC(): Checks whether x is a fractional numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • IND(): Checks whether x is an indexing vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • LGL(): Checks whether x is a logical vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NEG(): Checks whether x is a negative numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NGW(): Checks whether x is a negative whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NNG(): Checks whether x is a non-negative numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NNW(): Checks whether x is a non-negative whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NPS(): Checks whether x is a non-positive numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NPW(): Checks whether x is a non-positive whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NST(): Checks whether x is a non-sortable vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • NUM(): Checks whether x is a numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • ODD(): Checks whether x is an odd, whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • ORD(): Checks whether x is an ordered factor vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • PCT(): Checks whether x is a percentage-valued numeric vector (i.e., in the range 0-100) subject to any count or value restriction arguments in .... Returns a logical scalar.

  • POS(): Checks whether x is a positive numeric vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • PPN(): Checks whether x is a proportion-valued numeric vector (i.e., in the range 0-1) subject to any count or value restriction arguments in .... Returns a logical scalar.

  • PSW(): Checks whether x is a positive whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • SRT(): Checks whether x is a sortable vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • STR(): Checks whether x is a string vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • UNO(): Checks whether x is an unordered factor vector subject to any count or value restriction arguments in .... Returns a logical scalar.

  • WHL(): Checks whether x is a whole-number vector subject to any count or value restriction arguments in .... Returns a logical scalar.

Specifying count and value restrictions

Specifying restrictions in ... is optional. The full set of recognized arguments names are defined in the following table along with the properties each specifies:

  ⁠.max, .maxr, .maxc⁠   Scalar maximum valid numbers of elements, rows, and columns, respectively.
   
  ⁠.min, .minr, .minc⁠ Scalar minimum valid numbers of elements, rows, and columns, respectively.
   
  ⁠.lt, .le, .ge, .gt⁠ Complete sortable scalar less-than, less-than-or-equal, greater-than-or-equal, and greater-than bounds, respectively.
   
  ⁠.n, .nr, .nc⁠ A vector of valid numbers of elements, rows, and columns, respectively.
   
  .vals A vector of valid values.

See Also

Other properties: as_mmm(), bbb_ccc_help(), bbb_help(), bbb_mmm_prop_funs(), ccc_help(), cls(), cmp_ccc_help(), cmp_mmm_ccc_help(), cmp_mmm_help(), compatible(), ddd_prop_funs(), eee_help(), iii_help(), meets(), mmm_ccc_help(), ppp_fast_help(), ppp_help(), sss_ccc_help(), sss_prop_funs(), unq_ccc_prop_funs(), unq_mmm_ccc_help(), unq_mmm_help()

Examples

mmm_funs()
mmm_props()
mmm(letters)
mmm(1:10)
mmm(c(pi, log(10), exp(1)))
is_mmm_spec("invalid")
is_mmm_spec("psw|srt")
MMM(1:10, "psw|srt")
MMM(letters, "ch1")
MMM(letters, "srt")
MMM(1:10, "ch3")
CH1(letters)
SRT(letters)
CLR(1:10)
CLR("blue")
CLR("#1077ACFF")

j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.