Re: [R] R code -column headings

2009-03-06 Thread Gabor Grothendieck
To do that be sure to give each dimension, itself, a name when the matrix is defined: mat <-matrix(c(266, 359, 533, 313, 555, 504, 502, 242), nrow = 4, dimnames = list(Region = c("Northeast", "Midwest", "South", "West"), Type = c("Public", "Private"))) as.da

Re: [R] R code -column headings

2009-03-06 Thread jim holtman
Answer to your first question: > x<-matrix(c(266, 359, 533, 313, 555, 504, 502, 242),nrow=4) > rownames(x)=c( "Northeast", "Midwest", "South", "West" ) > colnames(x)=c("Public", "Private") > y <- as.data.frame(as.table(x)) > names(y)[1:2] <- c("Region", "Type") > y RegionType Freq 1 North

[R] R code -column headings

2009-03-06 Thread Mary A. Marion
Hello, I have been noticing that some of my column headings are missing. Can you give me a clue as to how to 1] replace Var1 and Var 2 by Region and type ie do it right the first time x<-matrix(c(266, 359, 533, 313, 555, 504, 502, 242),nrow=4) rownames(x)=c( "Northeast", "Midwest", "South", "