Question: In R studio, I am trying to shift the binary string 0 1 0 0 1 1 0 1 0 1 0 0 1 0

In R studio, I am trying to shift the binary string 0 1 0 0 1 1 0 1 0 1 0 0 1 0 0 0 0 1 0 to the right by 1. I am using bitwShiftR(x,1). X is the variable where that binary string is stored. When I run the code I just get a string of all zeros. What am I doing wrong? Below is my code on how I stored the binary string

VEC <- utf8ToInt('MHID9870')

BIN <- binary(VEC, mb=7)

splitting0 <- strsplit(BIN, "")

CHAR0 <- unlist(strsplit(BIN, ""))

xr <- as.integer(c(CHAR0))

x <- xr[1:19] y <- xr[20:41]

z <- xr[21:64]

shifting <- bitwShiftR(x, 1)

Output is 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!