Convert InferenceData column names to tidy column names
Source:R/inferencedata_df_to_tidy_draws.R
idata_names_to_tidy_names.Rd
InferenceData column names for scalar variables are of the form
"('group', 'var_name')"
, while column names for array variables are of the
form "('group', 'var_name[i,j]', 'i_name', 'j_name')"
.
This function converts these column names to a format that is useful for
creating tidy_draws data frames.
"('group', 'var_name')"
becomes "group|var_name"
"('group', 'var_name[i,j]', 'i_name', 'j_name')"
becomes
"group|var_name[i_name, j_name]"
Examples
forecasttools:::idata_names_to_tidy_names(c(
"('group', 'var_name')",
"group|var_name[i_name, j_name]"
))
#> [1] "group|var_name" "group|var_name[i_name|j_name]"