I'm trying to generate a character vector that includes a sequence of n numbers (as character) with m empty string elements in between each number element.
I managed to generate the vector using a loop. Is there a way to implement this more conciseley without a loop, and would this be more efficient?
sequence = character(0)
n = 3
m = 2
for(i in 1:n){
sequence <- c(sequence, rep("",m), i)
i <- i + 1
}
The output is a vector like:
c("","","1","","","2","","","3")