An inputted matrix or 3-dimensional array is first subsetted - by rownames - to remove those subjects who are not in `id2keep`. After that, the object's rows are ordered to match the ordering of subject ids in the vector `id2keep`. This (possibly reordered) object is returned.

subset_input(input, id2keep)

Arguments

input

a matrix of either phenotypes or covariates or array of allele probabilities

id2keep

a character vector of subject ids to identify those subjects that are shared by all inputs

Value

an object resulting from subsetting of `input`. Its rows are ordered per `id2keep`

Examples

# define s_id s_id <- paste0("s", 1:10) # set up input matrix foo <- matrix(data = rnorm(10 * 3), nrow = 10, ncol = 3) rownames(foo) <- s_id subset_input(input = foo, id2keep = s_id)
#> [,1] [,2] [,3] #> s1 -1.34074797 -2.16814685 0.4169224 #> s2 -2.19271124 -0.91754935 -2.2745533 #> s3 1.56809186 0.10268885 -1.2683205 #> s4 -0.03514251 0.07783576 0.6346674 #> s5 1.55185708 -0.54841718 0.2799669 #> s6 -0.63760140 2.20743416 1.1000911 #> s7 -0.98548753 0.31547913 0.6364982 #> s8 -2.10558882 0.03216748 0.8395000 #> s9 -0.04354969 0.15585690 -0.3503503 #> s10 0.90456079 -1.62969131 1.1048359