[R] Change the result data

Philipp Pagel p.pagel at gsf.de
Fri Feb 27 13:14:43 CET 2004


Using stack() would be a possibility:

> a <- stack(as.data.frame(hec.data))
> a$eye=rownames(hec.data)
> a
   values   ind   eye
1       5 Black Green
2      15 Black Hazel
3      20 Black  Blue
4      68 Black Brown
5      29 Brown Green
6      54 Brown Hazel
7      84 Brown  Blue
8     119 Brown Brown
9      14   Red Green
10     14   Red Hazel
11     17   Red  Blue
12     26   Red Brown
13     16 Blond Green
14     10 Blond Hazel
15     94 Blond  Blue
16      7 Blond Brown


Also have a look at reshape().

cu
	Philipp

-- 
Dr. Philipp Pagel                                Tel.  +49-89-3187-3675
Institute for Bioinformatics / MIPS              Fax.  +49-89-3187-3585
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/~pagel




More information about the R-help mailing list