Skip to contents

Add a column returned by a function that takes the data of the flat table as a parameter.

Usage

add_custom_column(ft, name, definition)

# S3 method for flat_table
add_custom_column(ft, name = NULL, definition)

Arguments

ft

A flat_table object.

name

A string, new column name.

definition

A function that returns a table column.

Value

A flat_table object.

Examples


f <- function(table) {
  paste0(table$City, ' - ', table$State)
}

ft <- flat_table('ft_num', ft_num) |>
  add_custom_column(name = 'city_state', definition = f)