powered by
Change to string nested lists in a given data.frame
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" )
Modified input data.frame
data.frame, input data.frame
character vector, df column names containing objects
NULL/character vector, object properties (NULL means all)
flag, whether the rows of the columns contain multiple objects
string/NULL, cell header
string, how to combine objects
string/NULL, cell footer
string/NULL, object header
string, how to combine properties
string/NULL, object footer
string, sprintf fmt parameter with two `%s` fields (property
string, value for NULL object property name, value)
string, behavior for missing column(s): "warn" - log warning, "skip" - skip missing column(s), "stop" - throw error
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 = ", ")
Run the code above in your browser using DataLab