Skip to contents

A data.frame of equal-length columns, each a scalar type, a factor, or option() of one, with automatic row names. An open table also accepts columns its declaration does not name. A table's rules run once per row and read the row's columns by name. With of, a table whose columns are the fields of a struct. new_table_type() declares a table type with a name, whose values are tables.

Usage

type_table(columns = list(), open = FALSE, rules = list(), of = NULL)

Arguments

columns

Named list of fields or field types.

open

Logical: Accept columns the declaration does not name.

rules

A rule(), or a list of rule() calls, over a row's columns.

of

Optional R8 struct type: The struct whose fields are the columns, in place of columns, open, and rules.

Value

An r8_field_type.

Examples

type_table(
  list(start = type_integer(), width = type_integer(min = 0L)),
  rules = list(rule(
    start + width - 1 <= 2147483647,
    message = "The end fits in an integer.",
    id = "END_FITS"
  ))
)
#> <r8 field type> table with the columns start (integer), width (integer [0, Inf))