pre_process: Pre process raw data from database

Description Usage Arguments Value Note Examples

View source: R/process.R

Description

To be run after initial_check() check has passed. Parses columns, removes undesired TargetNames, replaces synonyms of TargetNames, and when only Controls present addes new row for with TargetName of 'negative'. ie adds new 'negative' pathogen when no ResultType == organism present.

Usage

1
2
3
4
5
6
7
pre_process(
  df,
  target_PouchTitle = "Respiratory_Panel",
  remove_targets = c("Bocavirus", "Bordetella parapertussis (IS1001)"),
  synonyms = list(`Coronavirus OC43` = c("Coronavirus OC43", "Coronavirus OC43 (RP)"),
    `Bordetella pertussis` = c("Bordetella pertussis", "Bordetella pertussis (ptxP)"))
)

Arguments

df

dataframe of raw RP panel (and non RP panel) data with at least the following columns: "FlaggedAsValidation", "TargetName", "StartTime", "AssayName", "AssayResult", "StartTime", "ZipCode", "Region", "Country"

target_PouchTitle

Name of the PouchTitle of interest

remove_targets

character vector of TargetNames you want to remove (or NULL)

synonyms

put NULL if don't want to use. Otherwise named list where each element of the list are TargetNames that are synonyms and should be combined, the name of the element is the name to replace the synonyms with.

Value

Dataframe with synonyms and FlaggedAsValidation == 0 rows removed, StartTime column parsed to date, synonyms replaced, and unnecessary columns removed

Note

This function may take several minutes to run when large dataframe is used.

Examples

1

MartinHoldrege/turnr documentation built on May 16, 2020, 10:39 a.m.