For an object read in with a LoadCountry function, sets the per capita active cases (pInf) to NA or removes them from the dataset based on input conditions. Can be used to remove data that is not recent, or data that produces low or negative estimates of per capita cases, or risk. Can also be used to remove data that is NA by country or by region.

tidy_Data(
  DATA,
  tidy = TRUE,
  DaysOld = 30,
  minimumpercapitaactivecases = 0,
  RiskEval = NULL,
  dropNACountry = TRUE,
  dropNAall = FALSE
)

Arguments

DATA

Data created using a LoadCountry call.

tidy

If TRUE, then perform tidying according to other parameters. If FALSE, then do nothing.

DaysOld

Set any pInf data more than this days old to NA.

minimumpercapitaactivecases

Set any pInf data less than this to NA.

RiskEval

Set pInf to NA when risk is below RiskEval$minimumRisk (%) using RiskEval$ascertainmentbias and a maximum group size, RiskEval$maximumN (Note: this setting overwrites minimumpercapitaactivecases).

dropNACountry

If TRUE, remove rows for countries whose pInf estimates all return NA.

dropNAall

If TRUE, remove rows for any region whose pInf estimates all return NA

Value

Returns input simple feature with NA values for pInf according to input options.

Examples

if (FALSE) {
Europe1 <- LoadEurope() #tidy_Data is run within LoadX functions.
Europe2 <- LoadEurope(tidy = FALSE)
Europe2 <- tidy_Data(Europe2)
}