namelist
Reading from the source googlesheet:
source_df <- ep_gs_id %>% read_sheet(sheet = sheet_names(ep_gs_id)[1])
Adding multilingual EP names and abbreviations to namelist
:
source_df %>% select(code = Environmental_pressure_code, nl_name = Environmental_pressure_name_NL, en_name = Environmental_pressure_name_EN, nl_shortname = Environmental_pressure_abbrev_NL, en_shortname = Environmental_pressure_abbrev_EN) %>% gather(key = "key", value = "value", matches(".+name|.+explanation|.+epclass")) %>% separate(key, c("lang", "key")) %>% spread(key = key, value = value) %>% bind_rows(read_vc(namelist_path, root), .) %>% write_vc(namelist_path, root)
Adding explanations to namelist
:
source_df %>% select(code = Environmental_pressure_code, nl_name = Explanation_NL, en_name = Explanation_EN, nl_shortname = Remarks_NL, en_shortname = Remarks_EN) %>% mutate(code = str_c(code, "_explan")) %>% gather(key = "key", value = "value", contains("name")) %>% separate(key, c("lang", "key")) %>% spread(key = key, value = value) %>% filter(!is.na(name) | !is.na(shortname)) %>% bind_rows(read_vc(namelist_path, root), .) %>% write_vc(namelist_path, root)
Adding ep_classes to namelist
:
source_df %>% select(code = Environmental_pressure_code, nl_name = Environmental_pressure_class_NL, en_name = Environmental_pressure_class_EN) %>% gather(key = "key", value = "value", contains("name")) %>% separate(key, c("lang", "key")) %>% spread(key = key, value = value) %>% filter(!is.na(name)) %>% mutate(code = str_c("ep_class_", str_match(code, "ep_(..).*")[,2] ) ) %>% mutate(shortname = NA %>% as.character) %>% bind_rows(read_vc(namelist_path, root), .) %>% write_vc(namelist_path, root)
env_pressures
data sourceSet path and filename of env_pressures
:
ep_path <- "inst/textdata/env_pressures"
Generate:
source_df %>% select(ep_code = Environmental_pressure_code) %>% mutate(ep_class = str_c("ep_class_", str_match(ep_code, "ep_(..).*")[,2] ), explanation = str_c(ep_code, "_explan") ) %>% mutate(ep_code = factor(ep_code), ep_class = factor(ep_class)) %>% write_vc(ep_path, root, sorting = "ep_code", optimize = FALSE, strict = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.