Skip to contents

get_epitrax reads an EpiTrax data file and creates a structured object containing the data along with commonly used metadata and empty report lists.

Usage

get_epitrax(data_file = NULL)

Arguments

data_file

Optional filepath. Data file should be a CSV. If this parameter is NULL, the user will be prompted to choose a file interactively.

Value

An object of class "epitrax" containing:

  • data: The validated and formatted EpiTrax data

  • diseases: Vector of unique diseases in the dataset

  • yrs: Vector of years in the dataset

  • report_year: Most recent year in the dataset

  • report_month: Most recent month in report_year

  • internal_reports: Empty list to store internal reports

  • public_reports: Empty list to store public reports

Examples

if (FALSE) { # \dontrun{
# Interactive file chooser:
get_epitrax()
} # }

# Using sample data included with package
data_file <- system.file("sample_data/sample_epitrax_data.csv",
                         package = "epitraxr")
epitrax <- get_epitrax(data_file)

# Access components
head(epitrax$data)
#>     disease month year counts
#> 1 Influenza     8 2020      1
#> 2 Influenza    12 2019      1
#> 3 Influenza     7 2021      1
#> 4  COVID-19     7 2024      1
#> 5 Influenza     6 2020      1
#> 6 Influenza     4 2022      1
epitrax$diseases
#> [1] "Influenza"  "COVID-19"   "Measles"    "Chickenpox" "Syphilis"  
epitrax$report_year
#> [1] 2024