Spaces are redundant when representing a binary sequence. This code
x <- '1 0 0 0 0 0 1 1 0 1 0 1 1 0 '
y<-gsub(' +', '', x)
does the job, so I can copy and paste from R. How to do the same for sequences 0-1 (and other single-bit data) in other formats, for example,
x <- c(1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0)
or
toString(x)
or whatever (for the sake of exploring various options)? Thanks.
source
share