See also the reshape package.

Cheers,

Simon.

Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia 
T: +61 7 3365 2506 
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

The combination of some data and an aching desire for 
an answer does not ensure that a reasonable answer can 
be extracted from a given body of data. - John Tukey.



-----Original Message-----
From: r-help-bounces@r-project.org on behalf of ppaarrkk
Sent: Sat 26/04/2008 7:54 AM
To: r-help@r-project.org
Subject: [R]  Equivalent of Excel pivot tables in R
 

Can somebody tell me how to do the equivalent of a pivot table in R ?


For example, if I have :

var1    var2   var3
a         x        10
b         y        20
a         z        10
b         z        20
a         z        10
b         z        20

I could have :

          x       y       z
a        1       0       2 
b        0       1       2

where entries in the table are counts of var3.

          x       y       z
a        10       0       20 
b        0       20       40

where entries are sums of var3.



I would expect it to be tapply(), but I can't see how it would be done.


Any suggestions please.


-- 
View this message in context: http://www.nabble.com/Equivalent-of-Excel-pivot-tables-in-R-tp16906289p16906289.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.


	[[alternative HTML version deleted]]

