Select columns from a matrix using an integer bitmap
Arguments
- data
A numeric matrix in tidy form
- intMask
An Integer vector whose length equals number of columns in data
Details
Selects columns from a matrix. A column is included in the output when the corresponding mask value is 1.
Examples
e12 <- embed(mgls, 13)
tn <- e12[ , 1]
pn <- e12[ ,2:13]
msk <- integer(12)
msk[c(1,2,3,4,6,7,9)] <- 1 # select these columns
p <- select_by_mask(pn, msk)
gamma_test(predictors = p, target = tn)
#> $Gamma
#> [1] 3.586398e-05
#>
#> $vratio
#> [1] 0.0004557331
#>
msk <- int_to_intMask(15, 12) # pick out the first four columns
p <- select_by_mask(pn, msk)
gamma_test(predictors = p, target = tn)
#> $Gamma
#> [1] 0.000656887
#>
#> $vratio
#> [1] 0.008347239
#>