HI, May be this helps: for(i in letters) { ? n <- n+1 ? x[n,] <- c(i, n) cat("loop", n, "\n") } x #or for(i in seq_along(letters)) { ? n <- n+1 ? x[n,] <- c(letters[i], n) cat("loop", i, "\n") } x A.K. #How can I add the loop counter in #2 to the loop in #1.? #*************** #1. x <- matrix( , ncol = 2, nrow = 26) # empty matrix n <- 0???? #set n to 0 for(i in letters) { ? n <- n+1 ? x[n,] <- c(i, n) } x #*********** #2. for (i in 1:10) { cat("loop", i, "\n") }