[R] Converting Decimal numbers into Binary
Paul Bernal
p@u|bern@|07 @end|ng |rom gm@||@com
Fri Dec 27 16:42:36 CET 2019
Dear friends,
Hope you are all doing well. I need to find a way to convert ascii numbers
to six digit binary numbers:
I am working with this example, I converted the string to ascii, and
finally to decimal, but I am having trouble converting the decimal numbers
into their six digit binary representation. The code below is exactly what
I have so far:
ascii_datformat <- utf8ToInt("133m using ogP00PD;88MD5MTDww using 2D7k")
ascii_datformat
Base <- ascii_datformat - 48
ifelse(Base > 40, Base-8, Base)
x <- rev(intToBits(Base))
dec2bin <- function(x) paste(as.integer(rev(intToBits(x))), collapse = "")
dec2bin
any guidance will be greatly appreciated,
Best regards,
Paul
[[alternative HTML version deleted]]
More information about the R-help
mailing list