Get a cohort table from a gdb object.

getCohort(object, cohort, fields = "*", keepAll = FALSE)

# S4 method for gdb
getCohort(object, cohort, fields = "*", keepAll = FALSE)

Arguments

object

an object of class gdb

cohort

name of cohort to get.

fields

columns to retain

keepAll

defaults to FALSE, for internal use.

Examples

library(rvatData)
gdb <- gdb(rvat_example("rvatData.gdb"))

# retrieve a cohort
cohort <- getCohort(gdb, cohort = "pheno")
head(cohort)
#>    IID sex pheno pop superPop       PC1       PC2        PC3         PC4
#> 1 ALS1   2     1 PJL      SAS  22.58749  4.738025 38.9157564 -10.1667342
#> 2 ALS2   2     1 BEB      SAS  26.37370 -1.445903 31.9712989  -6.0222555
#> 3 ALS3   1     1 TSI      EUR  30.75496 48.866843 -5.4092404  14.9474404
#> 4 ALS4   2     1 GWD      AFR -87.48035 -6.193628 -0.9504131  -1.2029932
#> 5 ALS5   1     1 MSL      AFR -87.79310 -5.323925 -1.0353300  -0.7403234
#> 6 ALS6   1     1 YRI      AFR -86.64071 -3.418417 -1.3964977   1.0561607
#>        age
#> 1 66.01743
#> 2 66.84306
#> 3 54.35749
#> 4 65.09777
#> 5 58.94664
#> 6 63.13635

# retrieve a cohort, keep specified fields
cohort <- getCohort(gdb, cohort = "pheno", fields = c("IID", "sex", "pheno"))
head(cohort)
#>    IID sex pheno
#> 1 ALS1   2     1
#> 2 ALS2   2     1
#> 3 ALS3   1     1
#> 4 ALS4   2     1
#> 5 ALS5   1     1
#> 6 ALS6   1     1