dfm_gen: fixed absence of out$codes field

master
Erik de Vries 5 years ago
parent b249ff22de
commit 2fc48cc2f7

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

Loading…
Cancel
Save