r - splitting a vector with strings -
i have vector, filled strings of length 2:
vec <-c( "00", "10", "00", "01", "11", "11", "10", "00",...)
i want split strings of vector length 1:
result <- "0", "0", "1", "0", "0", "0", "0",...)
the last step merge vector entries strings of length 8:
qpsk <- "00100001", "11111000",...)
i know there function strsplit , function paste, don't know how use in case. there efficient way this?
thanks
try
strsplit(paste(vec, collapse=''), '(?<=.{8})', perl=true)[[1]] #[1] "00100001" "11111000" "0100"
data
vec <-c( "00", "10", "00", "01", "11", "11", "10", "00", "01", "00")