R/frequency.R

Defines functions freq_fx

Documented in freq_fx

#' frequency
#'
#' rounds the values in its first argument to the specified number of decimal places (default 0).
#' @param vec vector in which have only two values, 0 and 1.
#' @param na.rm na.rm
#' @param digits digits
#' @return percent
#' @example
#'    a <- c(1,0,0,0,1,0,0,0)
#'    freq_fx(a)
#'@export

freq_fx <- function(vec, na.rm = TRUE, digits = 1) {
  round_new(mean(vec, na.rm = na.rm) * 100, digits)
}
Sanggeun/g.function.bsg documentation built on May 15, 2020, 3:50 p.m.