This may be a simple question but I can not find how to produce pairs of values from a vector sequentially which each pair includes last value and new value in a matrix of v
## define input
C <- c(1 , 20 , 44 , 62 , 64 , 89 , 91, 100)
## replicate all but first and last elements
Crep <- rep(C,c(1,rep(2,length(C)-2),1))
## create matrix
matrix(Crep,ncol=2,byrow=TRUE)