Try this:

 xtabs(Freq ~ Hair + Eye + Sex, Dat)

Using Dimitri's Dat example.

On Fri, Feb 18, 2011 at 5:50 AM, Lao Meng <laomen...@gmail.com> wrote:

> The data is in the attachment.
>
> What I wanna get is:
> , , Sex = Male
>       Eye
> Hair    Brown Blue Hazel Green
>  Black    32   11    10     3
>  Brown    53   50    25    15
>  Red      10   10     7     7
>  Blond     3   30     5     8
> , , Sex = Female
>       Eye
> Hair    Brown Blue Hazel Green
>  Black    36    9     5     2
>  Brown    66   34    29    14
>  Red      16    7     7     7
>  Blond     4   64     5     8
>
>
> Then,how to change the dataframe to tables?
>
> Many thanks for your help.
>
> Best
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to