In quanteda 0.9.7-20:
k1 <- kwic(inaugCorpus, "brexit")
class(k1) ## logical
k1 ## NA
k2 <- kwic(inaugCorpus, "independence")
class(k2) ## kwic data.frame
This breaks some natural aggregation procedures, such as
res <- list()
for (i in 1:N)
res[[ i ]] <- kwic(subcorpus[i], "independence")
do.call(rbind, res) ## stack kwics
One workaround is to check is.data.frame(k1) before doing anything (not to check is.na(k1) which will trigger warnings when evaluated on a kwic with matches).
As implied by the help page, kwic should return an empty data.frame, not NA.
┆Issue is synchronized with this Asana task
In quanteda 0.9.7-20:
This breaks some natural aggregation procedures, such as
One workaround is to check
is.data.frame(k1)before doing anything (not to checkis.na(k1)which will trigger warnings when evaluated on a kwic with matches).As implied by the help page, kwic should return an empty
data.frame, notNA.┆Issue is synchronized with this Asana task