Skip to content

Incorporate further post-processing after translated_join() into functions #4

Description

@CarwilB

Current code does post-processing after translation…

1.

translate_event_responsibility <- function
[...]
df_translated <- df %>% 
      translated_join_vars(c("protest_domain", "pres_admin", "event_title")) %>%
                 select(-protest_domain, -pres_admin) %>% #rm translated vars except index_var
                 rename_with(~ paste0(.x, source_suffix), index_var) %>%  # mark index_var
                 rename_with(~ sub(dest_suffix, "", .x), everything()) %>%  # unmark translated vars
                 relocate(index_var_marked, .after = last_col()) %>% # keeping this column to match
                 relocate(event_title)

2.

second_level_es <-second_level %>% 
  translated_join_vars(c("dec_affiliation", "perp_affiliation", 
                         "state_responsibility", "intentionality"), 
                       translation) %>%
  select(event_title, date, dec_firstname, dec_surnames, age, dec_affiliation_es,
         #           cause_death_es,
         perp_affiliation_es, state_responsibility_es, 
         intentionality_es, unconfirmed) %>%
  rename_with(~ sub("_es$", "", .x), everything())

3.

don <- don %>% translated_join_vars( 
                     c("event_title", "dec_affiliation", 
                       "state_responsibility", "intentionality",
                       "protest_domain"),
                     translation) %>%
    mutate(cause_death_es = str_c("(en): ", cause_death)) %>%
    add_nameline_es() %>%
    add_dateline_es() %>% 
    add_simple_label_es() %>%
    add_detailed_label() %>%
    add_detailed_label_es()

4.

domain.responsibility_es <- domain.responsibility %>% 
  translated_join("protest_domain", translation) %>%
  relocate(protest_domain_es)

The goal of this issue is either to incorporate these tasks into translated_join(), or create helper functions after the fact so that these tasks are functionalized and clearly stated in the function titles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions