[R] Matrix Dimnames

Rookie rookie8823 at gmail.com
Wed Aug 18 00:24:59 CEST 2010


Is there a way that I can specify the column names in the matrix function? Currently, below is the way I am doing it.

x <- matrix(c(15, 7, 20, 12, 25, 14, 30, 19, 35, 7, 15, 7, 20, 17, 25, 19, 30, 25, 35, 10, 15, 15, 20, 12, 25, 19, 30, 22, 35, 11, 15, 11, 20, 18, 25, 18, 30, 19, 35, 15, 15, 9, 20, 18, 25, 18, 30, 23, 35, 11), nrow=25, byrow=TRUE)
colnames(x) <- c("Cotton", "Observations")
x


More information about the R-help mailing list