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