What do you mean by `a repeatedly ragged array': you haven't defined it? There is no dataset `barley' in vanilla R. Which one did you mean? There is a data frame in package lattice, but that is neither an array nor ragged.
If that is what you want, rank.lists will be a list matrix. The easiest thing to do is to find out the corresponding row numbers and assign there. pos <- with(barley, tapply(1:120, list(site=site, year=year), na.pass)) barley[unlist(pos), "ranks"] <- unlist(rank.lists) On Mon, 13 Sep 2004, Wolfram Fischer wrote: > How can I add an extra column containing the rank > to a ragged array indexed by more than one grouping > factors? > > 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''. > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Please do as that asks, including reading its references. We should not have to guess at the meaning of your subject line, where you got a dataset from etc. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html