Package 'faersquarterlydata'

Title: FDA Adverse Event Reporting System Quarterly Data Extracting Tool
Description: An easy framework to read FDA Adverse Event Reporting System XML/ASCII files <https://www.fda.gov/drugs/questions-and-answers-fdas-adverse-event-reporting-system-faers/fda-adverse-event-reporting-system-faers-latest-quarterly-data-files>.
Authors: Luis Garcez [aut, cre, cph]
Maintainer: Luis Garcez <[email protected]>
License: GPL (>= 3)
Version: 1.2.0
Built: 2025-01-26 04:10:52 UTC
Source: https://github.com/luisgarcez11/faersquarterlydata

Help Index


List ASCII data example

Description

A list containing data from FDA website. The list only contains safety reports which the ADR primary suspect drug was indicated for ALS. List originated from retrieve_faersascii

Usage

als_faers_data

Format

A data frame with 200 rows and 38 columns:

Source

<https://www.fda.gov/drugs/questions-and-answers-fdas-adverse-event-reporting-system-faers/fda-adverse-event-reporting-system-faers-latest-quarterly-data-files>


Tabular ASCII data example

Description

A subset of data from FAERS data. One row corresponds to one adverse drug reaction. All the ADR in this subset have a primary suspect drug indicated for ALS. Data frame originated from unify_tabular_ascii

Usage

als_faers_data_unified

Format

A data frame with 1635 rows and 40 columns.


Convert a date string into a date format

Description

Convert a date string into a date format

Usage

arrange_date(date_string)

Arguments

date_string

A string vector with multiple formats (8, 6 or 4 digits)

Value

A converted Date

Examples

arrange_date("2020")
arrange_date("202006")
arrange_date("20200601")

Estimate Chi-Squared test with yates correction

Description

Estimate Chi-Squared test with yates correction

Usage

estimate_chisq(n11, n10, n01, n00)

Arguments

n11

Number of events of interest within the group of interest

n10

Number of events of interest from all groups

n01

Number of all events within the group of interest

n00

Number of all events from all groups

Value

list with Chi-squared statistic and p-value

Examples

estimate_chisq(n11 = 20, n10 = 10, n01 = 200, n00 = 200)

Estimate Information Component

Description

Estimate Information Component

Usage

estimate_infoc(n11, n10, n01, n00)

Arguments

n11

Number of events of interest within the group of interest

n10

Number of events of interest from all groups

n01

Number of all events within the group of interest

n00

Number of all events from all groups

Value

List with Information Component estimate and its 0.95 IC

Examples

estimate_infoc(n11 = 20, n10 = 10, n01 = 200, n00 = 200)

Estimate Proportional Reporting Odds Ratio

Description

Estimate Proportional Reporting Odds Ratio

Usage

estimate_prr(n11, n10, n01, n00, ic_range = 0.95)

Arguments

n11

Number of events of interest within the group of interest

n10

Number of events of interest from all groups

n01

Number of all events within the group of interest

n00

Number of all events from all groups

ic_range

Confidence Interval range

Value

Proportional Reporting Odds Ratio

Examples

estimate_prr(n11 = 20, n10 = 10, n01 = 200, n00 = 200)

Estimate Reporting Odds Ratio

Description

Estimate Reporting Odds Ratio

Usage

estimate_ror(n11, n10, n01, n00, ic_range = 0.95)

Arguments

n11

Number of events of interest within the group of interest

n10

Number of events of interest from all groups

n01

Number of all events within the group of interest

n00

Number of all events from all groups

ic_range

Confidence Interval range

Value

list with ROR estimate and a vector with the IC boundaries

Examples

estimate_ror(n11 = 20, n10 = 10, n01 = 200, n00 = 200, ic_range = 0.90)

Estimate Measures of Association

Description

Estimate Measures of Association

Usage

estimate_ror_bygroup(
  tabular_faers_data,
  group_of_interest_col = NULL,
  group_of_interest_ref = NULL,
  rename_vector = NULL,
  event_of_interest_col = NULL,
  ...
)

Arguments

tabular_faers_data

FAERS tabular format. Output of function retrieve_faersxml or retrieve_faersxml_all

group_of_interest_col

a string, specifying the group of interest. Must me a column name of 'tabular_faers_data', and this columns should only contain two unique values.

group_of_interest_ref

a string, specifying the group of interest reference. Must me a value from the group of interest column.

rename_vector

optional. named vector to rename the group of interest, in order to show up in a

event_of_interest_col

a string, specifying the event of interest. Must me a column name of 'tabular_faers_data'.

...

arguments passed to 'estimate_ror' like 'ic_range'.

Value

tibble with the event of interest counts, group of interest counts and the respective estimated measures of association (ROR and its IC, PRR and its IC, Information Component and Chi-squared statisti with Yates correction.

Examples

estimate_ror_bygroup(tabular_faers_data = dplyr::filter(als_faers_data_unified,
sex %in% c("M", "F") ),
group_of_interest_col = "sex",
group_of_interest_ref = "M",
event_of_interest_col = "pt")

Convert FAERS xml to an R list

Description

Convert FAERS xml to an R list

Usage

faersxml_to_r(xml_address)

Arguments

xml_address

XML address file

Value

a list containing all the elements from 'xml_address'


Get duplicated caseIDs

Description

Retrieve the duplicated caseIDs to remove from the analysis.

Usage

get_duplicate_caseids(duplicates_dir = NULL)

Arguments

duplicates_dir

directory path where the text files with the duplicates information are.

Value

an integer vector with all the caseids to be removed


List of approved products by FDA

Description

List of approved products by FDA

Usage

products_fda

Format

A data frame.

Source

<https://www.fda.gov/drugs/drug-approvals-and-databases/drugsfda-data-files>


Read FAERS ascii files

Description

Read ASCII files from a directory, removing the duplicates.

Usage

retrieve_faersascii(
  ascii_dir,
  cache_path = NULL,
  drug_indication_pattern = NULL,
  drug_pattern = NULL,
  primary_suspect = TRUE,
  ...
)

Arguments

ascii_dir

directory path where ascii files are

cache_path

(optional) a string. Must have a ".Rdata" extension to save the read tabular formats in each loop.

drug_indication_pattern

(optional) a string.filter ADRs with a specific drug indication pattern (**stringr** sintax)

drug_pattern

(optional) a string. filter ADRs with a specific drug name pattern (**stringr** sintax)

primary_suspect

(optional) a string.

...

directory with duplicate information to be passed to get_duplicate_caseids

Value

A list with binded tibbles retrieved from files.


Convert FAERS xml to tabular format

Description

Convert FAERS xml to tabular format

Usage

retrieve_faersxml(
  xml_address,
  reaction_wise = TRUE,
  drug_wise = FALSE,
  drug_indication_pattern = NULL
)

Arguments

xml_address

XML address to be read

reaction_wise

each row corresponds to a reaction (if TRUE, drug_wise cannot be TRUE)

drug_wise

each row corresponds to a drug (if TRUE, reaction_wise cannot be TRUE)

drug_indication_pattern

filter by ADR with a specific drug indication pattern (**stringr** sintax)

Value

A tibble corresponding to the XML file


Convert FAERS a number of xml files to tabular format

Description

Convert FAERS a number of xml files to tabular format

Usage

retrieve_faersxml_all(xml_address_vector, ..., cache_path = NULL)

Arguments

xml_address_vector

Vector with XML addresses to be read

...

arguments to be passed to retrieve_faersxml

cache_path

a string. Must have a ".Rdata" extension to save the read tabular formats in each loop.

Value

A binded tibble with all the tibbles returned from 'retrieve_faersxml'


Retrieve unique drug and ADR information values from XML files

Description

Retrieve unique drug and ADR information values from XML files

Usage

retrieve_unique_info(xml_address_vector, ...)

Arguments

xml_address_vector

Vector with XML addresses to be read

...

arguments to be passed to retrieve_faersxml

Value

A list with all the unique information on FAERS variables


FAERS description

Description

FAERS description

Usage

summary_faersdata(tabular_faers_data)

Arguments

tabular_faers_data

a tibble corresponding to the unified FAERS tabular format. Output of function unify_tabular_ascii

Value

A list with a findings summary

Examples

summary_faersdata(als_faers_data_unified)

Unify the list to a tabular format

Description

Turn the list elements returned from retrieve_faersascii into a tabular format

Usage

unify_tabular_ascii(ascii_list)

Arguments

ascii_list

list from retrieve_faersascii

Value

A data frame representing FAERS data, with all components from the list joined.

Examples

unify_tabular_ascii(ascii_list = als_faers_data)

Unzip FAERS zip folders

Description

Unzip FAERS zip folders

Usage

unzip_faerszip(zip_folders_dir, ex_dir)

Arguments

zip_folders_dir

directory containing FAERS zip folders

ex_dir

directory to be exported the unzipped files

Value

None. Just unzips the folders to a specified location.