Thanks!
It works well.



2011/2/18 Dimitris Rizopoulos <d.rizopoulos@erasmusmc.nl>

> say, 'Dat' is your data frame, then one way to do it is:
>
> with(Dat, tapply(freq, list(hair, eye, sex), c))
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
>
>
> On 2/18/2011 8:50 AM, Lao Meng 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Dimitris Rizopoulos
> Assistant Professor
> Department of Biostatistics
> Erasmus University Medical Center
>
> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
> Tel: +31/(0)10/7043478
> Fax: +31/(0)10/7043014
> Web: http://www.erasmusmc.nl/biostatistiek/
>

	[[alternative HTML version deleted]]

