Skip to contents

Phenotype

Usage

phenotype(
  x,
  id_col,
  include,
  exclude = NULL,
  code_cols = list(`ICD9 codes` = NULL, `ICD10 codes` = NULL, `OPCS4 codes` = NULL,
    `Read codes v2` = NULL, `Read codes v3` = NULL),
  gsub = NULL,
  name = "overall",
  include_multi = "any",
  exclude_multi = "any",
  verbose = TRUE,
  ...
)

Arguments

x

a data.frame like object or file path readable by data.table::fread

id_col

a string, the name of the id column

include

a string or list of strings, a valid phenotype id (see get_phenotypes())

exclude

a string or list of strings, a valid phenotype id (see get_phenotypes())

code_cols

a list of named strings, the diagnosis and procedure code column(s). List elements must be one or more of icd9, icd10, opcs, readv2, readv3

gsub

a list of characters of length 3, pre-processing of phenotype codes and/or codes in x. E.g. c(".", "", "both"). NULL to turn off. Element 1: a character, regex pattern. Element 2: a character, replacement string. Element 3: a character vector, one or more of: 'x' (apply to codes in x only), 'pheno' (apply to codes in pheno files only), 'both' (apply to both x and all pheno files), or a phenotype_id in include or exclude (apply to that phenotype).

name

a string, a name for the phenotype

include_multi

a string, how to deal with multiple include phenotypes, either 'all' (all required) or 'any' (all required)

exclude_multi

a string, how to deal with multiple exclude phenotypes, either 'all' (all required) or 'any' (all required)

verbose

a logical, print progress

...

other parameters passed to gsub

Value

a data.table