Well,it's my daily work on duty,not homework:)
2011/2/18 Dennis Murphy
> This is a built-in dataset in R - see ?HairEyeColor and str() it. I smell
> homework...
>
> Dennis
>
> On Thu, Feb 17, 2011 at 11:50 PM, Lao Meng wrote:
>
>> The data is in the attachment.
>>
>> What I wanna get is:
Thanks!
It works well.
2011/2/18 Henrique Dallazuanna
> Try this:
>
> xtabs(Freq ~ Hair + Eye + Sex, Dat)
>
> Using Dimitri's Dat example.
>
> On Fri, Feb 18, 2011 at 5:50 AM, Lao Meng wrote:
>
>> The data is in the attachment.
>>
>> What I wanna get is:
>> , , Sex = Male
>> Eye
>> Ha
Thanks!
It works well.
2011/2/18 Dimitris Rizopoulos
> 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.
Try this:
xtabs(Freq ~ Hair + Eye + Sex, Dat)
Using Dimitri's Dat example.
On Fri, Feb 18, 2011 at 5:50 AM, Lao Meng wrote:
> The data is in the attachment.
>
> What I wanna get is:
> , , Sex = Male
> Eye
> HairBrown Blue Hazel Green
> Black32 1110 3
> Brown53
This is a built-in dataset in R - see ?HairEyeColor and str() it. I smell
homework...
Dennis
On Thu, Feb 17, 2011 at 11:50 PM, Lao Meng wrote:
> The data is in the attachment.
>
> What I wanna get is:
> , , Sex = Male
> Eye
> HairBrown Blue Hazel Green
> Black32 1110 3
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
HairBrown Blue Hazel Green
6 matches
Mail list logo