Validate obs_population object for imuGAP
Check observation meta data object
Usage
check_obs_population(
obs_population,
observations,
locations,
max_cohort,
max_age
)
check_obs_population(
obs_population,
observations,
locations,
max_cohort,
max_age
)Arguments
- obs_population
a data.frame, the the observation weighting object, with columns
obs_id, the observation id the row concerns
dose, which dose the row concerns
location, the location the row concerns
cohort, the cohort at that location the row concerns
age, the age of that cohort the row concerns
weight, the relative contribution of this row to an observation Note that multiple rows may concern the same observation, meaning that the populations from different cohorts, locations, and ages may be pooled in an observation
- observations
a
data.framewith:nonnegative integer
positivecolumnpositive integer
sample_ncolumn, which must be greater than or equal to thepositivecolumnoptionally, an
idcolumn, 1:size(observations)
- locations
a
data.frame, with integer columnsidandparent_id. See Details for restrictions.- max_cohort
if present, what is the maximum cohort that should be present?
- max_age
if present, what is the maximum age that should be present?
- max_obs_id
optional positive integer, the maximum valid observation id
- max_location
optional positive integer, the maximum valid location id
- subset
logical; if
FALSE(default), observations must be complete. IfTRUE,max_obs_idmust be provided.
Details
A valid obs_population object must:
be convertible to a
data.tableviadata.table::setDT()contain the columns "obs_id", "location", "cohort", "age", "dose", and "weight"
obs_id, integers >= 1; if
max_obs_idis provided, <=max_obs_id; ifsubsetisFALSE, all integers 1:max_obs_idmust be presentlocation must be a positive integer less than or equal to
max_location. however, not all locations need to be represented inwtscohort must be a positive integer
age must be a positive integer
dose must be 1 or 2
weight must be a positive numeric value; weights must sum to 1 by obs_id
