Given an integer, I need to convert it into a vector of n bits which correspond to the binary representation of the given integer.
Examples:
1 should return 0 0 0 1
2 should return 0 0 1 0
3 should return 0 0 1 1
4 should return 0 1 0 0
How do I achieve this in R using R libraries?