Learn R Programming

dmtools (version 0.2.4)

test_sites: Test sites

Description

Test sites

Usage

test_sites(objs, func)

Arguments

objs

A list of objects.

func

A function e.g. choose_test, get_result.

Value

A data frame. The dataset.

Examples

Run this code
# NOT RUN {
site <- c("site 01", "site 02")
id <- c("01", "02")
age <- c("19", "20")
sex <- c("f", "m")
gluc_post <- c("5.5", "4.1")
gluc_res_post <- c("norm", "no")
ast_post <- c("30", "48")
ast_res_post <- c(NA, "norm")

df <- data.frame(
  site, id, age, sex,
  gluc_post, gluc_res_post,
  ast_post, ast_res_post,
  stringsAsFactors = FALSE
)

refs_s01 <- system.file("labs_refer_s01.xlsx", package = "dmtools")
refs_s02 <- system.file("labs_refer_s02.xlsx", package = "dmtools")

s01_lab <- lab(refs_s01, id, age, sex, "norm", "no", site = "site 01")
s02_lab <- lab(refs_s02, id, age, sex, "norm", "no", site = "site 02")

labs <- list(s01_lab, s02_lab)
labs <- check_sites(labs, df, site)

test_sites(labs, func = function(lab) choose_test(lab, "mis"))

# }

Run the code above in your browser using DataLab