[R] Matrix/Table col headings R 2.0.0

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Oct 21 15:20:21 CEST 2004


Robert W. Baer, Ph.D. wrote:

> I have been looking at some 'table' examples in Peter Dalgaard's ISwR book, and I am confused by how to get right justification of my table headings when I use the tables() command.  Compare the following:
> 
> # Produces right justfified column names
> caff.marital=matrix(c(652,1537,598,242,36,46,38,21,218,327,106,67),nrow=3,byrow=T)
> colnames(caff.marital)=c("0","1-150","151-300",">300")
> rownames(caff.marital)=c("Married","Prev.married","Single")
> caff.marital
> class(caff.marital)
> 
> #Produces Left justified column names
> library(ISwR)
> data(juul)
> attach(juul)
> sex.tan=table(sex,tanner)
> colnames(sex.tan)=c("I","II","IIII","IV","V")
> rownames(sex.tan)=c("M","F")
> sex.tan
> class(sex.tan)
> 
> # Finally, look at (left justified)
> as.table(caff.marital)
> 
> Somehow PD got right justified columns with this dataset.  Is there a new way of doing things in version 2.0.0, my ignorance, a bug?  I tried making the columns factors first, but in my hands this did not appear to help either.  Thanks for any insight.

[Since this question seems to be unanswered:]

This is a question related to Peter Dalgaard's book, so why don't you 
ask the author rather than the whole world?

Note that caff.materia is a matrix while as.table(caff.marital) is a 
table (and has a different print method).

Why does the justification matter here? I'm much too lazy to look for 
changes in R related to your question - but probably you have done 
yourself before asking the question...???
And why don't you cite the example you are referring to (e.g. by a page 
number!!!) exactly? I'm also too lazy to read Peter's book once more 
just in order to find the example you are talking about!

Uwe Ligges


>>version
> 
>       _              
> platform i386-pc-mingw32
> arch     i386           
> os       mingw32        
> system   i386, mingw32  
> status                  
> major    2              
> minor    0.0            
> year     2004           
> month    10             
> day      04             
> language R 
> 
>   ___________________________
> Robert W. Baer, Ph.D.
> Department of Physiology
> A. T. Still University of Health Science
> 800 W. Jefferson St. 
> Kirksville, MO 63501-1497 USA
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 	[[alternative HTML version deleted]]




More information about the R-help mailing list