Look at the following simple code and operations:
library(Rcpp) library(microbenchmark) set.seed(100) x <- sample(0:1, 1000000, replace =