I have a column in a dataframe consisting of a 8 bit bitmask. I want to 'explode' this to 8 new columns in my data frame. The bitmask is defined as:

```
mask <- c('term1'=1,'term2'=2,'term3'=4,'term4'=8,...) #etc

```

by the end, I want 8 new columns in my dataframe named term1 through term8 with a TRUE/FALSE value noting whether the bit was set. For example, with a 3 bit mask:

```
id   bitmask
 a         1
 b         4
 c         5

```

would be come:

```
id   bitmask   term1   term2   term3
 a         1    TRUE   FALSE   FALSE
 b         4   FALSE   FALSE    TRUE
 c         5    TRUE    FALSE    TRUE

```

I've gotten as far as writing the function that creates the bitmask column values:

```
addl <- as.data.frame(sapply(data$bitmask, function(x) bitwAnd(x,mask) > 0))

```

But I'm obviously doing something wrong because when I try to see the result using head(addl) it just hangs. I haven't even gotten to the point of cbind() or setting the column names. Any help understanding what I'm doing wrong would be greatly appreciated!