nunique {Animal}R Documentation

Count unique occurrences of variables

Description

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

Usage

nunique(x)

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

#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)


[Package Animal version 1.01 Index]