[R] Adding ranks to a repeatedly ragged array

Wolfram Fischer wolfram at fischer-zim.ch
Mon Sep 13 09:34:15 CEST 2004

How can I add an extra column containing the rank
to a ragged array indexed by more than one grouping

E.g. with the barley dataset: 
How can I to add an additional column ``rank''
containing the rank of the ``yield'' of
the different varieties in relation to the indices
``year'' and ``site'' to the barley dataframe?

I achieved to calculate the ranks with:
	rank.lists <-
	with( barley, tapply( yield, list( site=site, year=year ), rank ) )
but I do not manage to merge this result
to the original dataframe ``barley''.



More information about the R-help mailing list