Another possibility:
rowSums(table(x) > 0)
On Sun, Jun 13, 2010 at 3:08 PM, Erik Iverson wrote:
> I think ?tapply will help here. But *please* read the posting guide and
> provide minimal, reproducible examples!
>
>
> Birdnerd wrote:
>
>> I have a data frame with two factors (sampling 'unit'
Hi Dennis,
Thanks for this suggestion (which I got to run!), as this code makes
intuitive sense, whereas not all the other suggestions were that
straightforward. I'm relatively new to programming in R and am very
appreciative that you and others take time to help out where you can.
Sincerely,
Sa
Hi:
Another possibility:
as.data.frame(with(data[!duplicated(data), ], table(unit))
unit Freq
1 1233
2 3454
HTH,
Dennis
On Sun, Jun 13, 2010 at 9:07 AM, Birdnerd wrote:
>
> I have a data frame with two factors (sampling 'unit', 'species'). I want
> to
> calculate the number of uni
On Sun, 13 Jun 2010, Birdnerd wrote:
I have a data frame 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’.
If I underst
You can also use the sqldf package:
> x
unit species
1 123ACMA
2 123LIDE
3 123LIDE
4 123SESE
5 123SESE
6 123SESE
7 345HEAR
8 345LOHI
9 345QUAG
10 345TODI
> require(sqldf)
> sqldf('select unit, count(distinct species) as count from x gro
Hi there,
Try
with(data, tapply(species, unit, function(x) length(unique(x
HTH,
Jorge
On Sun, Jun 13, 2010 at 12:07 PM, Birdnerd <> wrote:
>
> I have a data frame with two factors (sampling 'unit', 'species'). I want
> to
> calculate the number of unique 'species' per 'unit.' I can calcul
I think ?tapply will help here. But *please* read the posting guide and provide
minimal, reproducible examples!
Birdnerd wrote:
I have a data frame with two factors (sampling 'unit', 'species'). I want to
calculate the number of unique 'species' per 'unit.' I can calculate the
number of unique
I have a data frame 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")
> a
8 matches
Mail list logo