Displaying 1 result from an estimated 1 matches for "sr_sort_practice".
2010 Jun 13
5
Count of unique factors within another factor
...ame with two factors (sampling 'unit', 'species'). I want to
calculate the number of unique 'species' per 'unit.' I can calculate the
number of unique values for each variable separately, but can't get a count
for each ?unit?.
> data=read.csv("C:/Desktop/sr_sort_practice.csv")
> attach(data)
> data[1:10,]
unit species
1 123 ACMA
2 123 LIDE
3 123 LIDE
4 123 SESE
5 123 SESE
6 123 SESE
7 345 HEAR
8 345 LOHI
9 345 QUAG
10 345 TODI?..
> sr.unique<- lapply (data, unique)
$unit
[1] 123 345 216
$species...