[R] Converting binary number to in Two´s complement representation

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Mon Jan 20 12:38:59 CET 2020


Hello,

Is this what you want?


x <- "10110010"
strtoi(x, base = 2)
#[1] 178


Hope this helps,

Rui Barradas

Às 16:31 de 16/01/20, Paul Bernal escreveu:
> Dear friends,
> 
> How can I convert the following binary number in two´s complement
> representation in R?
> 
> 10110010
> 
> Any help and/or guidance will be greatly appreciated,
> 
> Best regards,
> 
> Paul
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.
>



More information about the R-help mailing list