Skip to content

Commit

Permalink
in case of uncompress in package dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Nov 8, 2023
1 parent 2f81ec8 commit 53671c1
Show file tree
Hide file tree
Showing 19 changed files with 542 additions and 482 deletions.
5 changes: 4 additions & 1 deletion R/class-FAERS.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
#' @examples
#' # ususaly we use faers() function to create a `FAERS` object
#' # you must change `dir`, as the file included in the package is sampled
#' data <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
#' data <- faers(2004, "q1",
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' faers_data(data)
#' faers_year(data)
#' faers_quarter(data)
Expand Down
3 changes: 2 additions & 1 deletion R/counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#' @examples
#' # you must change `dir`, as the files included in the package are sampled
#' data <- faers(c(2004, 2017), c("q1", "q2"),
#' dir = system.file("extdata", package = "faers")
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' \dontrun{
#' # you must standardize and deduplication before disproportionality analysis
Expand Down
3 changes: 2 additions & 1 deletion R/dedup.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#' @examples
#' # you must change `dir`, as the files included in the package are sampled
#' data <- faers(c(2004, 2017), c("q1", "q2"),
#' dir = system.file("extdata", package = "faers")
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' \dontrun{
#' # we must standardize firstly
Expand Down
5 changes: 4 additions & 1 deletion R/faers.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#' @return A [FAERSxml] or [FAERSascii] object.
#' @examples
#' # you must change `dir`, as the file included in the package is sampled
#' data <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
#' data <- faers(2004, "q1",
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' @export
faers <- function(years, quarters, format = NULL, dir = getwd(), compress_dir = dir, handle_opts = list()) {
format <- match.arg(format, faers_file_format)
Expand Down
5 changes: 4 additions & 1 deletion R/merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
#' @return A [data.table][data.table::data.table] object.
#' @examples
#' # you must change `dir`, as the file included in the package is sampled
#' data <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
#' data <- faers(2004, "q1",
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' faers_merge(data, "indi") # only one field is just like faers_get()
#' faers_merge(data, c("demo", "indi"))
#' @export
Expand Down
5 changes: 4 additions & 1 deletion R/methods-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
#' @return See details.
#' @examples
#' # you must change `dir`, as the file included in the package is sampled
#' data <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
#' data <- faers(2004, "q1",
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' faers_get(data, "indi")
#' data[["indi"]]
#' data$indi
Expand Down
3 changes: 2 additions & 1 deletion R/signal.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#' @examples
#' # you must change `dir`, as the files included in the package are sampled
#' data <- faers(c(2004, 2017), c("q1", "q2"),
#' dir = system.file("extdata", package = "faers")
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' \dontrun{
#' # you must standardize and deduplication before disproportionality analysis
Expand Down
3 changes: 2 additions & 1 deletion R/standardize.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#' @examples
#' #' # you must change `dir`, as the files included in the package are sampled
#' data <- faers(c(2004, 2017), c("q1", "q2"),
#' dir = system.file("extdata", package = "faers")
#' dir = system.file("extdata", package = "faers"),
#' compress_dir = tempdir()
#' )
#' \dontrun{
#' # you should replace `meddra_path` with yours
Expand Down
920 changes: 466 additions & 454 deletions README.html

Large diffs are not rendered by default.

32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ will parse metadata in

``` r
faers_meta()
#> → Using FAERS metadata from cached
#> '~/.cache/faers/metadata/faers_meta_data.rds'
#> Snapshot time: 2023-11-05 17:10:13.921026
#> → Reading html:
#> <https://fis.fda.gov/extensions/FPD-QDE-FAERS/FPD-QDE-FAERS.html>
#> → Writing FAERS metadata into cached
#> '~/.cache/R/faers/metadata/faers_meta_data.rds'
#> year quarter period
#> <int> <char> <char>
#> 1: 2023 q3 July - September
Expand Down Expand Up @@ -266,6 +267,9 @@ TRUE`.

``` r
faers_meta(internal = TRUE)
#> → Using FAERS metadata from cached
#> '~/.cache/R/faers/metadata/faers_meta_data.rds'
#> Snapshot time: 2023-11-08 14:33:01.032028
#> year quarter period
#> <int> <char> <char>
#> 1: 2023 q3 July - September
Expand Down Expand Up @@ -510,8 +514,12 @@ in the following process.)

``` r
# # you must change `dir`, as the file included in the package is sampled
data1 <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
data1 <- faers(2004, "q1",
dir = system.file("extdata", package = "faers"),
compress_dir = tempdir()
)
#> Finding 1 file already downloaded: 'aers_ascii_2004q1.zip'
#> → Nothing to do since only one <FAERS> data provided
data1
#> FAERS data from 1 Quarterly ascii file
#> Total reports: 100 (with duplicates)
Expand All @@ -522,11 +530,12 @@ the `faers_combine()` function is judiciously employed.

``` r
data2 <- faers(c(2004, 2017), c("q1", "q2"),
dir = system.file("extdata", package = "faers")
dir = system.file("extdata", package = "faers"),
compress_dir = tempdir()
)
#> Finding 2 files already downloaded: 'aers_ascii_2004q1.zip' and
#> 'faers_ascii_2017q2.zip'
#> → Combining all 2 FAERS Quarterly ascii Data files
#> → Combining all 2 <FAERS> Datas
data2
#> FAERS data from 2 Quarterly ascii files
#> Total reports: 200 (with duplicates)
Expand Down Expand Up @@ -597,8 +606,11 @@ sessionInfo()
#> [1] faers_0.99.0
#>
#> loaded via a namespace (and not attached):
#> [1] compiler_4.3.1 fastmap_1.1.1 cli_3.6.1 tools_4.3.1
#> [5] htmltools_0.5.5 rstudioapi_0.15.0 rappdirs_0.3.3 yaml_2.3.7
#> [9] rmarkdown_2.23 data.table_1.14.9 knitr_1.43 xfun_0.39
#> [13] digest_0.6.33 rlang_1.1.1 evaluate_0.21
#> [1] digest_0.6.33 R6_2.5.1 fastmap_1.1.1 rvest_1.0.3
#> [5] xfun_0.39 magrittr_2.0.3 rappdirs_0.3.3 glue_1.6.2
#> [9] stringr_1.5.0 knitr_1.43 htmltools_0.5.5 rmarkdown_2.23
#> [13] lifecycle_1.0.3 xml2_1.3.5 cli_3.6.1 vctrs_0.6.3
#> [17] data.table_1.14.9 compiler_4.3.1 httr_1.4.6 rstudioapi_0.15.0
#> [21] tools_4.3.1 curl_5.0.1 evaluate_0.21 yaml_2.3.7
#> [25] rlang_1.1.1 stringi_1.7.12 selectr_0.4-2
```
5 changes: 4 additions & 1 deletion man/FAERS-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/FAERS-methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/faers.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/faers_counts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/faers_dedup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/faers_merge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/faers_phv_signal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/faers_standardize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions vignettes/FAERS-Pharmacovigilance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,19 @@ in the following process.)

```{r}
# # you must change `dir`, as the file included in the package is sampled
data1 <- faers(2004, "q1", dir = system.file("extdata", package = "faers"))
data1 <- faers(2004, "q1",
dir = system.file("extdata", package = "faers"),
compress_dir = tempdir()
)
data1
```

Furthermore, in cases where multiple quarterly data files are requisite, the
`faers_combine()` function is judiciously employed.
```{r}
data2 <- faers(c(2004, 2017), c("q1", "q2"),
dir = system.file("extdata", package = "faers")
dir = system.file("extdata", package = "faers"),
compress_dir = tempdir()
)
data2
```
Expand Down

0 comments on commit 53671c1

Please sign in to comment.