Parse FAERS Quarterly Data

faers_parse(
  path,
  format = NULL,
  year = NULL,
  quarter = NULL,
  compress_dir = getwd()
)

Arguments

path

A string specifies the path of FAERS Quarterly Data. You can pass the FAERS zip file directly, In this way, all files in the zip file will be extracted in compress_dir. Or, you can also uncompressed youself, and passed the directory contained the uncompressed files.

format

File format to used, only "ascii" and "xml" are availabe. Default: "ascii".

year

Year of the FAERS Quarterly Data. Coerced into integer, if NULL, this will be extracted from path.

quarter

String specifies quarter of the FAERS data, if NULL, this will be extracted from path.

compress_dir

A string specifies the directory to extract files to. It will be created if necessary.

Value

A FAERSxml or FAERSascii object.

Unification

For all fields data:

  • All names have been converted to lowercase.

  • Rename "isr" into "primaryid" for periods before 2012q3.

Field specific operations:

  • demo:

    • Rename "gndr_cod" into "gender" for periods before 2014q2.

    • Rename "sex" into "gender" for periods after or equal to 2014q2.

    • Rename "case" and "i_f_cod" into "caseid" and "i_f_code" for legacy aers, before 2012q3.

    • "age_in_years" was added, measured in years.

    • "country_code" was added (encoded according to the iso2c standards), it will be convenient to translate it into other code with countrycode().

    • "sex" was added, which recoded "F" as "Female", "M" as "Male" and other values as NA.

  • ther: Rename "drug_seq" into "dsg_drug_seq" for legacy aers, before 2012q3.

  • indi: Rename "drug_seq" into "indi_drug_seq" for legacy aers, before 2012q3.

  • outc: Rename "outc_code" into "outc_cod" for 2012q4 data

Examples

# the files included in the package are sampled
data <- faers_parse(
    system.file("extdata", "aers_ascii_2004q1.zip", package = "faers"),
    compress_dir = tempdir()
)