Learn R Programming

sr (version 0.1.0)

int_to_intMask: Integer to Vector Bitmask

Description

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

Usage

int_to_intMask(i, length)

Value

A vector of integer containing 1 or 0

Arguments

i

A 32 bit integer

length

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

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

Run this code
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)

Run the code above in your browser using DataLab