nunique: Count unique occurrences of variables

Description Usage Arguments Details Value Author(s) Examples

Description

Returns the number of unique occurrences of each level in the input object.

Usage

1

Arguments

x

Numeric, character of factor vector

Details

Provides a convenient way to calculate the unique occurrences of certain events in daily, hourly, weekly and monthly data e.g. calculate the number of unique animals that have used the feeding throughs each hour in dataset RIC (see examples).

Value

Number of unique levels in the input object.

Author(s)

Matti Pastell <matti.pastell@helsinki.fi>

Examples

1
2
3
4
5
#Lets count the number of unique cows that have started to eat each hour
#in the dataset RIC.
data(RIC)
data <- clean.RIC(RIC)
hourly(RIC$cowID,RIC$begin,nunique)

Animal documentation built on May 2, 2019, 5:48 p.m.