[R] Change the result data

From: Muhammad Subianto <subianto_at_gmail.com>
Date: Tue 10 May 2005 - 22:37:31 EST


Dear R-helper,
I have a data like:

hec.data <-array(c(5,15,20,68,29,54,84,119,14,14,17,26,16,10,94,7),

               dim=c(4,4),
               dimnames=list(eye=c("Green","Hazel", "Blue", "Brown"),
               hair=c("Black", "Brown", "Red", "Blond")))
as.data.frame(as.table(hec.data))

> as.data.frame(as.table(hec.data))
eye hair Freq

1 Green Black 5
2 Hazel Black 15
3 Blue Black 20
4 Brown Black 68
5 Green Brown 29
6 Hazel Brown 54
7 Blue Brown 84
8 Brown Brown 119
9 Green Red 14
10 Hazel Red 14
11 Blue Red 17
12 Brown Red 26
13 Green Blond 16
14 Hazel Blond 10
15 Blue Blond 94
16 Brown Blond 7
>
    

I want to extract like,
Green Black
Green Black
Green Black
Green Black
Green Black
Hazel Black
Hazel Black
Hazel Black
Hazel Black

.
.
.

Brown Blond
Brown Blond
Brown Blond
Brown Blond
Brown Blond
Brown Blond
Brown Blond

How can I do it.
Thanks you for your help.

Best regards,
Muhammad Subianto
http://article.gmane.org/gmane.comp.lang.r.general/14604,14610



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 10 22:46:45 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:40 EST