Hi All- Thanks for your quick responses. I was looking for unique instances, so Jim's and Daniel's suggestions got the job done. Using "length" alone didn't discriminate between multiple occurrences of the same species and multiple species.
I do have one followup question- my full data set (not the example data) has a number of NAs in the SppID column, and [r] is currently counting the NAs as species occurrences. Using Jim's code, I tried: >tapply(SppID, PlotID, function(Trees, na.rm=T) length(unique(Trees, na.rm=T))) and alternately: >tapply(SppID, PlotID, function(Trees) length(unique(Trees)), na.rm=T) which doesn't seem to convince [r] to ignore the NAs. What am I doing wrong? Thanks, Ian [[alternative HTML version deleted]] ______________________________________________ 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.