frequencyQuery: stop with error if vc is empty
Change-Id: I641a97f614a99a650da8f80623f505a46da532dc
(cherry picked from commit e91be715286a1cfd25b82dc8932838f6d2f4eab4)
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index cf848f0..5ba459b 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -346,6 +346,7 @@
corpusQuery(kco, query, vc, metadataOnly = TRUE, as.df = TRUE, ...) %>%
mutate(total = corpusStats(kco, vc=vc, as.df=TRUE)$tokens)
} ) %>%
+ { if (.$total == 0) stop(paste0("Virtual corpus \"",vc, "\" is empty. Cannot calculate relative frequencies."), call. = FALSE) }
ci(conf.level = conf.level)
})