It's easy to change the names of the rows (e.g., with rownames()
), but that's not what I'm after. Consider:
> newTab <- xtabs(~as.factor(letters[1:2])+LETTERS[1:2])
> newTab
LETTERS[1:2]
as.factor(letters[1:2]) A B
a 1 0
b 0 1
I want to get this:
upper case
lower case A B
a 1 0
b 0 1
But if I try:
> dimnames(newTab) <- list("lower case", "upper case")
I get an error:
Error in dimnames(newTab) <- list("lower case", "upper case") :
length of 'dimnames' [1] not equal to array extent