hourly: Calculate hourly values from time series

Description Usage Arguments Value Author(s) See Also Examples

Description

Calculate hourly values (e.g mean or sum) from time series data. Allows to specify a subject to calculate hourly values for several subjects.

Usage

1
hourly(data, time, fun = sum, subject = NULL)

Arguments

data

A data vector that you want to calculate the hourly values for

time

Time stamps for data in POSIXct format

fun

The function to apply, defaults to sum

subject

You can optionally specify to a subject. e.g. to get hourly values for each cow in a herd.

Value

A data.frame with following elements

Hour

Hour 1-24

Subject

Appears only if you have specified a subject

Result

The result of the function

Author(s)

Matti Pastell <matti.pastell@helsinki.fi>

See Also

daily, weekly, monthly

Examples

1
2
3
4
5
6
data(RIC)
RIC2 <- clean.RIC(RIC)
#Hourly feed intake of a whole from data set RIC
herd <- hourly(RIC2$intake,time=RIC2$begin,fun=sum)
#Hourly feed intake of individual cows from data set RIC
herd <- hourly(RIC2$intake,time=RIC2$begin,fun=sum,subject=RIC2$cowID)

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