[R] Convert bits to numbers in base 10

Gang Chen gangchen6 at gmail.com
Thu Apr 9 23:23:32 CEST 2009


I have some bits stored like the following variable nn

(nn <- c(1, 0, 0, 1, 0, 1,0))
[1] 1 0 0 1 0 1 0

not in the format of

1001010

and I need to convert them to numbers in base 10. What's an easy way to do it?

TIA,
Gang




More information about the R-help mailing list