See the FAQ: How to do a minimal reproducible example reprex
for beginners. Lacking one, only abstract guidance is possible.
The source data for the first variable might look like purch
below,
representing a sequence of purchases for 28 consecutive seasons, in which case,
set.seed(137)
purch <- sample(0:5,28,replace=TRUE)
length(purch) - length(purch[which(purch == 0)])
#> [1] 25
indicating that 25 of 28 seasons had non-zero sales.
The other two are identical in form—boolean vectors, with TRUE/FALSE
values. Assuming there are two vectors, also of length 28, encoding multichannel status and gift dollar status, respectively through encoding of 1/0
. Then
cust_attribute <- c(1,0,0,1,1,0,0,0,1,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1)
cust_attribute > 0
#> [1] TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE TRUE
#> [13] TRUE FALSE FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE TRUE TRUE
#> [25] TRUE TRUE FALSE TRUE
This brings to the fore the want of a reprex.
Having to guess at the structure of the source data likely makes the answer less helpful than it might otherwise be.