parse_table: Parse a table

Description Usage Arguments See Also Examples

View source: R/tables.R

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 Aug. 20, 2017, 5:49 p.m.