ids <- c(rep("A", 4), rep("B", 6), rep("C", 2))
val <- paste(ids, c(1:4, 1:6, 1:2), sep = "")
nset(ids, 3, warn = FALSE)
matrix(val[nset(ids, 3, warn = FALSE)], ncol = 3)
matrix(val[nset(ids, 3, first = FALSE, warn = FALSE)], ncol = 3)
Run the code above in your browser using DataLab