R/inj_rate.R

Defines functions inj_rate

Documented in inj_rate

#' calculate injury rate
#' @import tidyverse
#' @importFrom magrittr %>%
#' @param x a dataframe
#' @importFrom dplyr select
#' @importFrom dplyr filter
#' @return p a object
#' @export
#'
#'


inj_rate <- function(x)
{

  t <- x %>% filter(injured == 'yes') %>% select(injured)
  p <- nrow(t)/nrow(x)
  return(p)


}
phdornever/Bjj documentation built on Dec. 14, 2017, 1:58 p.m.