R/count.R

Defines functions count.grouped_log count.log

Documented in count.grouped_log count.log

#' @title Count log
#' @name count
#' @param x \code{\link{log}}: Object of class \code{\link{eventlog}} or \code{\link{activitylog}}.
#' @param ... Variables to count on
#' @importFrom dplyr count
#' @export
dplyr::count


#' @describeIn count Count log 
#' @export

count.log <- function(x, ...) {
  
  x %>%
    as_tibble() %>%
    count(...) 

}

#' @describeIn count Count grouped log 
#' @export

count.grouped_log <- function(x, ...) {
  
  x %>%
    as_tibble() %>%
    group_by(pick(as.character(groups(x)))) %>%
    count(...) 
  
}

Try the bupaR package in your browser

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

bupaR documentation built on April 3, 2023, 5:23 p.m.