R/count_events.R

Defines functions count_events

Documented in count_events

#' Count HMM Events
#'
#' @param data
#'
#' @return
#' @export
#'
#' @examples
count_events <- function(data){

  counter <- table(paste0(head(data$state,-1),tail(data$state,-1)))

  count_events <- matrix(counter, nrow = 1)

  dimnames(count_events) <- list(c("transition counts"),
                                 c("From state 1 to 1", "1 to 2", "2 to 1", "2 to 2"))

  events <- tibble("No. Events" = count_events[2])

  return(events)

}
brentscott93/biophysr documentation built on Sept. 14, 2021, 2:35 a.m.