I would like to subset a vector {1,2,3,4} with a bool vector. For instance, if my bool vector was {false,true,true,true}, I would like to get vector {2,3,4}. In regular R, I could do this with
sample_states<-c(1:4)[c(a,b,c,d)]
where a,b,c,d are bools. My question is twofold: 1) How can I create a vector of bools using Armadillo/Rcpp, and 2) how can I use that vector to subset my vector {1,2,3,4}. Thank you in advance for your time.