I learned the following piece of C++ code about binary conversion and tried to translate it to R code, but not succeeded yet. Does anyone know how to do it?
for(int i = 0; i < 16: ++i) {
printf("%u%u%u%u", i/8%2, i/4%2, i/2%2, i%2);
}
C++ code is from below accepted answer from below post: