R/monthly.R

`monthly` <-
function (data, time, fun = sum, subject = NULL) 
{
    if (is.null(subject)) {
        result <- aggregate(data, list(month(time)), fun)
        names(result) <- c("Month", "Result")
    }
    else {
        result <- aggregate(data, list(month(time), subject), 
            fun)
        names(result) <- c("Month", "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.