I have a vector
s <- "111000"
v <- as.character(unlist(strsplit(s,"")))
I need to take vector v, turn into an 8-bit long string, and swap the 3rd and 4th variable.
So for example: Input Vector:
1 2 3 4 5 6
Output Vector:
1 2 4 3 4 3 5 6
EDIT, so a lot of people misunderstanding the input/output. The numbers simply indicated the variable placement and where it is being switched.
As to the actual vector in the problem: "111000".
Input Value: "1" "1" "1" "0" "0" "0"
Output Value: "1" "1" "0" "1" "0" "1" "0" "0"
EDIT: Sorry for the question, it's how it was worded to me. But basically I am trying to do a block expansion. I am trying to create a function to take a 6-bit vector and return an 8 bit-value with the values being the output above. I have added a photo diagraming what is going on: