Parse vocabulary from a set of names and convert to data.frame

parse_df(names, sep = "_")

Arguments

names

Names created by vocabulary as character vector

sep

Separator between different levels of name

Value

A data.frame with one row per name and one column per vocabulary level

Examples

vbl_names <- c("ind_a", "ind_b", "amt_a", "amt_c", "cat_c_pre", "cat_c_post") parse_df(vbl_names, sep = "_")
#> var_name level1 level2 level3 #> 1 ind_a ind a <NA> #> 2 ind_b ind b <NA> #> 3 amt_a amt a <NA> #> 4 amt_c amt c <NA> #> 5 cat_c_pre cat c pre #> 6 cat_c_post cat c post