Skip to contents

create_column_definition_list() is a vectorized version of create_column_definition() that uses a list or data frame input to create a list of column definitions. This list can be used as the columns argument for create_sp_list().

Usage

create_column_definition_list(definitions, col_type = "text", ignore_na = TRUE)

Arguments

definitions

A list or data frame with arguments to use in creation of column definitions.

col_type

Column type to use if not provided as a "type" column in the input definitions data frame. Allowed values include the Graph column type keys (e.g. "dateTime" or "personOrGroup") and the shorter names date, datetime, person, group, hyperlink, and picture. Not case sensitive. A "date" column uses format = "dateOnly" unless a format is supplied.

ignore_na

If TRUE, drop any parameters with a NA value.

Value

A list of named lists, one per row of definitions, each formatted as a columnDefinition (as created by create_column_definition()) for use as the columns argument to create_sp_list().

Details

Columns in definitions can use the argument names of the create_*_column() helpers (e.g. multiple_lines) or Graph property names (e.g. allowMultipleLines). See create_column_definition() for details.

Examples

definition_df <- data.frame(
  name = c("FirstColumn", "SecondColumn"),
  type = c("text", "number"),
  decimal_places = c(NA, 0),
  multiple_lines = c(TRUE, NA)
)

create_column_definition_list(definition_df)
#> [[1]]
#> [[1]]$name
#> [1] "FirstColumn"
#> 
#> [[1]]$text
#> [[1]]$text$allowMultipleLines
#> [1] TRUE
#> 
#> 
#> 
#> [[2]]
#> [[2]]$name
#> [1] "SecondColumn"
#> 
#> [[2]]$number
#> [[2]]$number$decimalPlaces
#> [1] "none"
#> 
#> 
#>