dfm_gen: re-added codes variable

master
Erik de Vries 6 years ago
parent 2fc48cc2f7
commit 0757b6bf8b

@ -31,14 +31,15 @@ dfm_gen <- function(out, words = '999', text = "lemmas", clean, cores = detectCo
}
if ('_source.codes.majorTopic' %in% colnames(out)) {
out <- out %>%
mutate(codes = .$`_source.codes.majorTopic`) %>%
mutate(junk = case_when(
.$`_source.codes.majorTopic` == 92 ~ 1,
.$`_source.codes.majorTopic` == 91 ~ 1,
.$`_source.codes.majorTopic` == 93 ~ 1,
.$codes == 92 ~ 1,
.$codes == 91 ~ 1,
.$codes == 93 ~ 1,
TRUE ~ 0
)
) %>%
mutate(aggregate = .$`_source.codes.majorTopic` %>%
mutate(aggregate = .$codes %>%
str_pad(4, side="right", pad="a") %>%
str_match("([0-9]{1,2})?[0|a][1-9|a]") %>%
.[,2] %>%

Loading…
Cancel
Save