Adding a 1 to the last bit in a binary number

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

 Data = 4065

twos <- twos_complement(Data)
 binary <- ! (twos) # makes it bibn
  ! (binary) # makes it the inverse
num_as_binary <- as.binary (4085, signed = TRUE, size =2)

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

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.