df_col_obj_implode {oaii}R Documentation

Change to string nested lists in a given data.frame

Description

Change to string nested lists in a given data.frame

Usage

df_col_obj_implode(
  df,
  col,
  obj_prop = NULL,
  nested = TRUE,
  cell_header = "",
  objs_glue = "----\n",
  cell_footer = "",
  obj_header = "",
  props_glue = "\n",
  obj_footer = "",
  prop_fmt = "%s: %s",
  null_prop_str = "[null]",
  on_missing_col = "warn"
)

Arguments

df

data.frame, input data.frame

col

character vector, df column names containing objects

obj_prop

NULL/character vector, object properties (NULL means all)

nested

flag, whether the rows of the columns contain multiple objects

cell_header

string/NULL, cell header

objs_glue

string, how to combine objects

cell_footer

string/NULL, cell footer

obj_header

string/NULL, object header

props_glue

string, how to combine properties

obj_footer

string/NULL, object footer

prop_fmt

string, sprintf fmt parameter with two '%s' fields (property

null_prop_str

string, value for NULL object property name, value)

on_missing_col

string, behavior for missing column(s): "warn" - log warning, "skip" - skip missing column(s), "stop" - throw error

Value

Modified input data.frame

Examples

df <- as.data.frame(do.call(cbind, list(
  a = list(list(x = 1, y = 2), list(x = 3, y = 4)),
  b = list("z", "z")
)))
df_col_obj_implode(df, "a", c("x", "y"), nested = FALSE, props_glue = ", ")


[Package oaii version 0.5.0 Index]