add check for valid structure of tables

This commit is contained in:
2021-08-10 12:42:41 +02:00
parent 4093cb603c
commit e038d86339
3 changed files with 39 additions and 0 deletions
+3
View File
@@ -7,6 +7,7 @@
#'
#' @export
find_word <- function(res, word) {
is_valid_res(res)
talks <- res$talks
mutate(
talks,
@@ -28,6 +29,7 @@ find_word <- function(res, word) {
#'
#' @export
join_speaker <- function(tb, res, fraction_only = F) {
is_valid_res(res)
joined <- left_join(tb, res$speaker, by=c("speaker" = "id"))
if (fraction_only) select(joined, "fraction")
else joined
@@ -145,6 +147,7 @@ bar_plot_fractions <- function(tb,
#'
#' @export
word_usage_by_date <- function(res, patterns, tidy=F) {
is_valid_res(res)
tb <- res$talks
nms <- names(patterns)
for (i in seq_along(patterns)) {