Skip to content

Commit

Permalink
Add encoded values to Features Used table in README and data dict
Browse files Browse the repository at this point in the history
  • Loading branch information
jeancochrane committed Jan 13, 2025
1 parent e3eca6c commit b8684fb
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 207 deletions.
20 changes: 16 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ param_tbl_fmt <- param_tbl %>%
description,
category = var_type,
type = var_data_type,
var_value, row
var_code, var_value, row
) %>%
mutate(category = recode(
category,
Expand All @@ -342,9 +342,20 @@ param_tbl_fmt <- param_tbl %>%
pivot_wider(
id_cols = `feature_name`:`category`,
names_from = row,
values_from = var_value
values_from = c(var_code, var_value)
) %>%
unite(
"possible_codes",
starts_with("var_code_X"),
sep = ", ",
na.rm = TRUE
) %>%
unite(
"possible_values",
starts_with("var_value_X"),
sep = ", ",
na.rm = TRUE
) %>%
unite("possible_values", starts_with("X"), sep = ", ", na.rm = TRUE) %>%
mutate(description = replace_na(description, "")) %>%
arrange(category)
Expand All @@ -359,7 +370,8 @@ param_tbl_fmt %>%
"Variable Name" = "variable_name",
"Description" = "description",
"Category" = "category",
"Possible Values" = "possible_values"
"Possible Values (Encoded)" = "possible_codes",
"Possible Values (Semantic)" = "possible_values",
) %>%
knitr::kable(format = "markdown")
```
Expand Down
Loading

0 comments on commit b8684fb

Please sign in to comment.