Generate sequence in R

6

My logic is failing. But could you help me create a vector of numbers in R with this rule here?

Vetor=1,222,2,223,3,224,4,.......,221,442

Many thanks.

    
asked by anonymous 20.09.2018 / 03:14

2 answers

9

I would do so:

rep(1:221, each = 2) + c(0, 221)
    
20.09.2018 / 05:46
6

Use rbind() to merge sequences.

x = rep(1:221)
y = (x + 221)

Vetor = c(rbind(x, y))

head(Vetor)
#[1]   1 222   2 223   3 224
    
20.09.2018 / 05:25