Questions tagged [plyr]

plyr refers to a set of tools for splitting, applying and combining data in R.

plyr refers to a set of tools for splitting, applying and combining data. It solves a common set of problems: the user needs to break a big problem down into manageable pieces, operate on each piece, and then put all the pieces back together. For example, the user might want to fit a model to each spatial location or time point in the study, summarize data by panels, or collapse high-dimensional arrays to simpler summary statistics.

2 questions
14
votes
6 answers

Fast ways in R to get the first row of a data frame grouped by an identifier

Sometimes I need to get only the first row of a data set grouped by an identifier, as when retrieving age and gender when there are multiple observations per individual. What's a fast (or the fastest) way to do this in R? I used aggregate() below…
lockedoff
  • 1,795
  • 2
  • 12
  • 19
11
votes
6 answers

How to find summary statistics for all unique combinations of factors in a data.frame in R?

I want to calculate a summary of a variable in a data.frame for each unique combination of factors in the data.frame. Should I use plyr to do this? I am ok with using loops as opposed to apply() ; so just finding out each unique combination would be…
humble Student