It is quite surprise to me that I could not find a ready answer for this question on stackoverflow.
In R, I have a vector of 0 and 1, and I wan
0
1
If the object size in memory is important (TRUE or FALSE are 56 bits size) a good option is the bit package, that can turn TRUE or FALSE values in a vector in to a 1 bit values vector.