Your question is incomplete... what do you expect the result to be? Perhaps [1] is relevant?
[1] https://stackoverflow.com/questions/52298995/r-binary-decimal-conversion-confusion-ais-data On December 27, 2019 7:42:36 AM PST, Paul Bernal <paulberna...@gmail.com> wrote: >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@ogP00PD;88MD5MTDww@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]] > >______________________________________________ >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.