1

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?

Aadith Ramia
  • 10,005
  • 19
  • 67
  • 86
  • This? https://stackoverflow.com/questions/6614283/converting-decimal-to-binary-in-r `R.utils::intToBin(10)` – Ronak Shah Jan 18 '19 at 03:25

0 Answers0