Hi, I am trying to make a new vector joing its values 2 by 2 (os n by n) using a loop, but I cant

An example:

c <- (a,b,f,g,t,h), then the new vector is (ab, fg, th). I am using a loop becouse I dont know any tool to do it

This is my atempt:

n <- 100

m <- n-2

s <- seq(from = 1, to = m, by = 2 )

flips = sample(c(1,0), replace=TRUE, size=n)

a <- as.character(seq(from = 1, to = m, by =2))

for (i in s) {

x=flips[i]

y=flips[(i+1)]

for (j in 1:length(s)){

a[j] <- paste(x, y, sep = "-" )

}

}

Can someone help me?

thanks in advance. Javi