create_matrix_byname(c(1, 2), nrow = 2, ncol = 1,
dimnames = list(c("r1", "r2"), "c1"))
create_matrix_byname(list(1, 2), nrow = list(1, 1), ncol = list(1,1),
dimnames = list(list("r1", "c1"), list("R1", "C1")))
Run the code above in your browser using DataLab