I have a simple 12 x 2
matrix called m
that contains my dataset (see below).
Question
I was wondering why when I use dimnames(m)
to create two names for the two columns of my data, I run into an Error
? Is there a better way to create column names for this data in R?
Here is my R code:
Group1 = rnorm(6, 7) ; Group2 = rnorm(6, 9)
Level = gl(n = 2, k = 6)
m = matrix(c(Group1 , Group2, Level), nrow = 12, ncol = 2)
dimnames(m) <- list( DV = Group1, Level = Level)