5
Suppose I have the following vectors:
n <- c(1:5)
c <- c("A","B","C","D","E")
I build the following matrix with them:
m <- matrix(c(n,c), ncol = 2)
What is the best way to obtain such a vector:
"1 - A", "2 - B", "3 - C", "4 - D", "5 - E"
without looping (for/while)?
I can use the command
vetor <- paste(m[1,1], m[1,2], sep = " - ")
but only the first element is created:
"1 - A"