R/hourly.R

`hourly` <-
function (data, time, fun = sum, subject = NULL) 
{
    if (is.null(subject)) {
        result <- aggregate(data, list(hour(time)), fun)
        names(result) <- c("Hour", "Result")
    }
    else {
        result <- aggregate(data, list(hour(time), subject), 
            fun)
        names(result) <- c("Hour", "Subject", "Result")
    }
    result
}

Try the Animal package in your browser

Any scripts or data that you put into this service are public.

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