Lukas - 1 year ago 60

R Question

I'm sure this is really simple, but I can't get my head around how to vectorise this for loop

`x <- 1:3`

y <- 11:13

z <- x[1]

for(i in 2:length(x)){

tem <- x[i] + y[i-1]

z <- c(z, tem)

}