Filter the final result of the object lab

# S3 method for lab
choose_test(obj, test = "mis", group_id = T)

Arguments

obj

An object. Class lab.

test

A character scalar. Parameters, which use to filter the final dataset, default: "mis": "ok" - analysis, which has a correct estimate of the result, "mis" - analysis, which has an incorrect estimate of the result, "skip" - analysis, which has an empty value of the estimate, "null" - analysis, which has an empty result and value of the estimate.

group_id

A logical scalar, default is TRUE.True is grouped by id, otherwise, it isn't grouped.

Value

The filtered dataset by a value of test.

Examples

ID <- c("01", "02", "03") SITE <- c("site 01", "site 02", "site 03") AGE <- c("19", "20", "22") SEX <- c("f", "m", "f") GLUC_V1 <- c(5.5, 4.1, 9.7) GLUC_IND_V1 <- c("norm", "no", "cl") AST_V2 <- c("30", "48", "31") AST_IND_V2 <- c(NA, "norm", "norm") df <- data.frame( ID, SITE, AGE, SEX, GLUC_V1, GLUC_IND_V1, AST_V2, AST_IND_V2, stringsAsFactors = FALSE ) refs <- system.file("labs_refer.xlsx", package = "dmtools") obj_lab <- lab(refs, ID, AGE, SEX, "norm", "no") obj_lab <- check(obj_lab, df) choose_test(obj_lab, "mis")
#> ID AGE SEX LBTEST LBTESTCD VISIT LBORNRLO LBORNRHI LBORRES #> 1 02 20 m Glucose GLUC _V1 3.9 5.9 4.1 #> 2 02 20 m Aspartate transaminase AST _V2 0.0 42.0 48 #> 3 03 22 f Glucose GLUC _V1 3.9 5.9 9.7 #> LBNRIND RES_TYPE_NUM IND_EXPECTED #> 1 no 4.1 norm #> 2 norm 48.0 no #> 3 cl 9.7 no