select_by_mask {sr} | R Documentation |
Select by Mask
Description
Select columns from a matrix using an integer bitmap
Usage
select_by_mask(data, intMask)
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.
Value
A matrix containing the columns of data for which intMask 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)
msk <- int_to_intMask(15, 12) # pick out the first four columns
p <- select_by_mask(pn, msk)
gamma_test(predictors = p, target = tn)
[Package sr version 0.1.0 Index]