diff --git a/R/clean_journals_continents.R b/R/clean_journals_continents.R index 4b2231a..ffde6b4 100644 --- a/R/clean_journals_continents.R +++ b/R/clean_journals_continents.R @@ -32,7 +32,7 @@ continent_order <- function(short = FALSE) { #' @noRd clean_journal_names <- function(journal) { x <- gsub("&", "and", journal, fixed = TRUE) - # x <- gsub(" of the United States of America", "", x, fixed = TRUE) + x <- gsub(" of the United States of America", "", x, fixed = TRUE) x <- gsub(":.*", "", x) x <- gsub("[(].*", "", x) x <- tools::toTitleCase(x) @@ -55,7 +55,7 @@ detect_missing_journals <- function(data) { #' instead of a regular dataframe (defaults to TRUE). #' @export table_journal_count <- function(data, datatable = TRUE) { - x <- dplyr::count(data, data$journal, data$field, data$year_range, sort = TRUE) %>% + x <- dplyr::count(data, .data$journal, .data$field, .data$year_range, sort = TRUE) %>% dplyr::mutate(field = stringr::str_to_title(.data$field)) %>% as.data.frame() %>% dplyr::rename("year range" = "year_range") %>% diff --git a/R/save_process_pubmed_batch.R b/R/save_process_pubmed_batch.R index a7017a6..4c86a2e 100644 --- a/R/save_process_pubmed_batch.R +++ b/R/save_process_pubmed_batch.R @@ -8,6 +8,7 @@ #' @param day_low The year the data should start. #' @param day_high The year the data should end. #' @param data_folder Where to save the data. +#' @param suffix What suffix to add to the name file. #' @param batch_size The download batch size. #' @param api_key The api key for faster processing (optional). #' @param verbose Whether to include progress messages. @@ -41,6 +42,7 @@ save_process_pubmed_batch <- function(pubmed_query_string = "", day_low = "01", day_high = 31, data_folder = "data", + suffix = "", batch_size = 5000, api_key = NULL, verbose = TRUE) { @@ -118,7 +120,7 @@ save_process_pubmed_batch <- function(pubmed_query_string = "", # Get full name country, continent, and region articles.df4 <- add_region(articles.df3) - saveRDS(articles.df4, paste0(data_folder, "/articles_", year_low, "_", year_high, ".rds")) + saveRDS(articles.df4, paste0(data_folder, "/articles_", year_low, "_", year_high, suffix, ".rds")) if (verbose) { start <- year_low @@ -139,7 +141,7 @@ save_process_pubmed_batch <- function(pubmed_query_string = "", success_message <- c( "Operation successfully completed. Congratulations!", print_time(), - "File saved in", paste0(data_folder, "/articles_", start, "_", end, ".rds\n\n") + "File saved in", paste0(data_folder, "/articles_", start, "_", end, suffix, ".rds\n\n") ) cat(success_message) diff --git a/data/journal_field.rda b/data/journal_field.rda index 2f016c0..74a6576 100644 Binary files a/data/journal_field.rda and b/data/journal_field.rda differ diff --git a/man/save_process_pubmed_batch.Rd b/man/save_process_pubmed_batch.Rd index 79158c8..e407712 100644 --- a/man/save_process_pubmed_batch.Rd +++ b/man/save_process_pubmed_batch.Rd @@ -14,6 +14,7 @@ save_process_pubmed_batch( day_low = "01", day_high = 31, data_folder = "data", + suffix = "", batch_size = 5000, api_key = NULL, verbose = TRUE @@ -38,6 +39,8 @@ save_process_pubmed_batch( \item{data_folder}{Where to save the data.} +\item{suffix}{What suffix to add to the name file.} + \item{batch_size}{The download batch size.} \item{api_key}{The api key for faster processing (optional).}