[R] Left justification af dimnames in tables.
p.dalgaard at biostat.ku.dk
Mon Nov 22 14:38:59 CET 2004
"Ladelund, Steen" <STELAD01 at glostruphosp.kbhamt.dk> writes:
> Hi helpeRs.
> When I do two-ways tables dimnames in columns are almost left-adjusted:
> <- factor(rbinom(30,1,.3),labels=c("first","second"))
> > b <- a
> > table(a,b)
> a first second
> first 21 0
> second 0 9
> If I do a oneway table however, dimnames are right-adjusted:
> first second
> 21 9
> Actually I must admit I dont know if its the dimnames or/and the cell counts
> that are adjusted ;-)
> Is there a way that I can get left-adjusted dimnames i oneway tables.
> Thans in advance
This was actually an inadvertent change in R 1.7.0. It is fixed in the
development version of R but it was decided to keep the fix out of the
patch versions because it would change a lot of printed output (and
some people run automatic checks for that). For a twoway table,
there's a simple workaround:
a first second
first 21 0
second 0 9
Unfortunately, it doesn't seem to work for multiway tables....
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help