Closed trinker closed 6 years ago
This works:
(x2 <- with(presidential_debates_2012, term_count(dialogue, TRUE, trpl_list[[1]])))
So detect emty tiers if only one unlist one level in both term_count
and read_term_list
families of functions and warn
This would catch it:
trpl_list <- read_term_list(file.path(tempdir(), 'cats.R'))
trpl_list2 <- list(
list(
response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
back_channels = c("uh[- ]huh", "uhuh", "yeah"),
summons = "hey",
justification = "because"
),
list(summons ='the'),
list(summons = 'it', justification = 'ed\\s')
)
trpl_list3 <- trpl_list[[1]]
is.list(trpl_list[[1]]) & length(trpl_list) == 1
is.list(trpl_list2[[1]]) & length(trpl_list2) == 1
is.list(trpl_list3[[1]]) & length(trpl_list3) == 1
Results: