parse_table: Parse a table

View source: R/tables.R

parse_tableR Documentation

Parse a table

Description

Applies parsers to a table and coerces the result to a table of the same type.

Usage

parse_table(x, functions, as = c("table", "list"), enclos = globalenv(),
  ...)

Arguments

x

Table.

functions

Function or list thereof. If a list, any names are reused in the parsed results.

as

Type of object to return. If "table", a table of the same type as x, otherwise a list.

enclos

Environment in which to look for objects not found in x.

...

Arguments passed to feval.

See Also

Other Table functions: as_table, create_table, is_table, parse_table_type, rbind_tables, remove_empty_dimensions, write_table

Examples

df <- data.frame(x = 1:5, y = 6:10)
parsers <- list(
  xx = function(x) {x + 10},
  xy = function(x, y) {x + y}
)
parse_table(df, parsers)
parse_table(as.list(df), parsers)
parse_table(df, parsers, as = "list")
parsers$z = function(z) {z * 10}
parse_table(df, parsers)
parse_table(df, parsers, as = "list")

columbia-glacier/cgr documentation built on Jan. 17, 2024, 2:42 p.m.