Skip to contents

Converts the bit representation of an integer into a vector of integers

Usage

int_to_intMask(i, length)

Arguments

i

A 32 bit integer

length

Integer length of the bitmask to produce, must be <= 32

Value

A vector of integer containing 1 or 0

Details

Converts an integer to a vector of ones and zeroes. Used as a helper function for full_embedding_search, it allows more compact storage of bit masks. The result reads left to right, so the one bit will have index of one in the vector corresponding to lag 1 in an embedding. Works for masks up to 32 bits

Examples

he <- embed(henon_x, 17)
t <- he[ , 1]
p <- he[ ,2:17]
mask <- int_to_intMask(7, 16)     # pick out the first three columns
pn <- select_by_mask(p, mask)
gamma_test(predictors = pn, target = t)
#> $Gamma
#> [1] 8.451127e-05
#> 
#> $vratio
#> [1] 8.27664e-05
#>