refactor again because of check complaining
This commit is contained in:
@@ -41,7 +41,7 @@ fetch_batch <- function(offset, download_dir) {
|
||||
#' if create is TRUE, the directory given in download_dir is created
|
||||
#'
|
||||
#' @export
|
||||
fetch_all <- function(download_dir="data/records/", create=FALSE) {
|
||||
fetch_all <- function(download_dir="inst/records/", create=FALSE) {
|
||||
# check if download_dir path is a directory path
|
||||
if (str_sub(download_dir, -1) != .Platform$file.sep)
|
||||
download_dir <- str_c(download_dir, .Platform$file.sep)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#' @param path character
|
||||
#'
|
||||
#' @export
|
||||
read_all <- function(path="data/records/") {
|
||||
read_all <- function(path="inst/records/") {
|
||||
cat("Reading all records from", path, "\n")
|
||||
available_protocols <- list.files(path)
|
||||
res <- pblapply(available_protocols, read_one, path=path)
|
||||
@@ -212,7 +212,7 @@ parse_speakerlist <- function(speakerliste_xml) {
|
||||
#' @param create set TRUE if the path does not exist yet and you want to create it
|
||||
#'
|
||||
#' @export
|
||||
write_to_csv <- function(tables, path="data/csv/", create=F) {
|
||||
write_to_csv <- function(tables, path="inst/csv/", create=F) {
|
||||
check_directory(path, create)
|
||||
write.table(tables$speaker, str_c(path, "speaker.csv"))
|
||||
write.table(tables$speeches, str_c(path, "speeches.csv"))
|
||||
@@ -229,7 +229,7 @@ write_to_csv <- function(tables, path="data/csv/", create=F) {
|
||||
#' reading the tables from a csv is way faster than reading and repairing the data every single time
|
||||
#'
|
||||
#' @export
|
||||
read_from_csv <- function(path="data/csv/") {
|
||||
read_from_csv <- function(path="inst/csv/") {
|
||||
list(speaker = read.table(str_c(path, "speaker.csv")) %>%
|
||||
tibble() %>%
|
||||
mutate(id = as.character(id)),
|
||||
|
||||
Reference in New Issue
Block a user