I am trying to change a 16-bit 2s complement back to binary then add a 1 to the last (Least Significant Bit) in R
I have this data set
where it gives
library(binaryLogic)
Data = 4065
twos <- twos_complement(Data)
binary <- ! (twos) # makes it bibn
! (binary) # makes it the inverse
#or
num_as_binary <- as.binary (4085, signed = TRUE, size =2)
!(num_as_binary)
But when I try to add a (1 or a TRUE) to the last bit things go haywire. Sometimes it does it correctly and sometimes it make the addition a 2 Is there any package that contains a function the Addbin in binaryLogic does not recognize the dataframe$V1 as a bin even if I force it
Thanks in advance