From 2263b11628d80bf6f56ccce8a7d0b6737c3f6345 Mon Sep 17 00:00:00 2001 From: yun Date: Tue, 7 Nov 2023 13:02:05 +0800 Subject: [PATCH] remove duplicated periods --- R/faers.R | 2 ++ tests/testthat/test_faers.R | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/R/faers.R b/R/faers.R index 7dced57..d864486 100644 --- a/R/faers.R +++ b/R/faers.R @@ -11,6 +11,8 @@ faers <- function(years, quarters, format = NULL, dir = getwd(), compress_dir = dir, handle_opts = list()) { format <- match.arg(format, faers_file_format) yq <- recycle_scalar(years = years, quarters = quarters) + data.table::setDT(yq) + yq <- unique(yq) faers_files <- do.call(faers_download, c( yq, list(format = format, dir = dir), handle_opts )) diff --git a/tests/testthat/test_faers.R b/tests/testthat/test_faers.R index 2e9cfcb..f56d915 100644 --- a/tests/testthat/test_faers.R +++ b/tests/testthat/test_faers.R @@ -12,6 +12,12 @@ testthat::test_that("faers() function works as expected", { dir = internal_file("extdata"), compress_dir = tempdir() )) + testthat::expect_no_error(data3 <- faers( + rep(c(2004, 2017), each = 2L), + rep(c("q1", "q2"), each = 2L), "ascii", + dir = internal_file("extdata"), + compress_dir = tempdir() + )) testthat::expect_s4_class(data3, "FAERSascii") testthat::expect_false(data3@deduplication) testthat::expect_false(data3@standardization)