[R] Rearranging long tables, Sweave, xtable, LaTeX
Ottorino-Luca Pantani
ottorino-luca.pantani at unifi.it
Thu Nov 12 12:16:50 CET 2009
Ista Zahn ha scritto:
> Yeah, I've had this kind of situation before. Usually I first see if I
> can fit it on the page by rotating it and/or reducing the size. If
> that doesn't do it then I'll re-arrange as you suggest. Basically the
> print method is just wrapping the output after n columns (27 in my
> case, but I think this depends on the options you have set). So you
> can do this wrapping yourself before calling xtable:
>
> tmp <- with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2))
> tmp2 <- rbind(tmp[,1:20], tmp[,21:40])
> xtable(tmp2)
>
> Hope it helps,
>
> Ista
>
>
>
Thanks a lot, but still there are problems.
My fault in the too simple code posted.
Consider the following
(tmp <- with(expand.grid(Fact1 = 1:3, Fact2 = c(letters[1:20], LETTERS[1:20])), table(Fact1, Fact2))
> Fact2 Fact1 a b c d e f g h i j k l m n o p q r s t A B C D E F G H I
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Fact2 Fact1 J K L M N O P Q R
> S T 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1
> 1 1 1
>From this table I can easily see, in the 1st row (Fact1)
which are the observations for the minuscule as well for the MAJUSCULE
while in
(tmp2 <- rbind(tmp[,1:20], tmp[,21:40]))
> a b c d e f g h i j k l m n o p q r s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> 1 1 1 1 1 1
the infomation on the MAJUSCULE factor is completely missing (hided).
More information about the R-help
mailing list