Add columns with constant values

df_add_constant_columns(x, ccols)

Arguments

x

[data.frame]
Data frame with at least one row and column.

ccols

[list]
Named list of single elements.

Value

Modified data frame.

See also

Other data frame helpers: df_add_category(), df_explode(), df_rows_to_list(), df_split_col()

Examples

x = data.frame(a = 1:2, b = 3:4) y = df_add_constant_columns(x, list(c = "a", d = 0.1))