|
|
|
@@ -233,6 +233,11 @@ parse_speakerlist <- function(speakerliste_xml) { |
|
|
|
#' |
|
|
|
#' @export |
|
|
|
write_to_csv <- function(tables, path="inst/csv/", create=F) { |
|
|
|
is_valid_res(tables) |
|
|
|
stopifnot("path must be of type character" = is.character(path)) |
|
|
|
stopifnot("create must be of type logical" = is.logical(create)) |
|
|
|
|
|
|
|
path <- make_directory_path(path) |
|
|
|
check_directory(path, create) |
|
|
|
write.table(tables$speaker, str_c(path, "speaker.csv")) |
|
|
|
write.table(tables$speeches, str_c(path, "speeches.csv")) |
|
|
|
@@ -250,6 +255,9 @@ write_to_csv <- function(tables, path="inst/csv/", create=F) { |
|
|
|
#' |
|
|
|
#' @export |
|
|
|
read_from_csv <- function(path="inst/csv/") { |
|
|
|
stopifnot("path must be of type character" = is.character(path)) |
|
|
|
|
|
|
|
path <- make_directory_path(path) |
|
|
|
list(speaker = read.table(str_c(path, "speaker.csv")) %>% |
|
|
|
tibble() %>% |
|
|
|
mutate(id = as.character(id)), |
|
|
|
@@ -259,5 +267,7 @@ read_from_csv <- function(path="inst/csv/") { |
|
|
|
date = as.Date(date)), |
|
|
|
talks = tibble %$% read.table(str_c(path, "talks.csv")), |
|
|
|
comments = tibble %$% read.table(str_c(path, "comments.csv")), |
|
|
|
applause = tibble %$% read.table(str_c(path, "applause.csv"))) |
|
|
|
applause = tibble %$% read.table(str_c(path, "applause.csv"))) -> res |
|
|
|
is_valid_res(res) |
|
|
|
res |
|
|
|
} |