R/as_percent.R

Defines functions as_percent

Documented in as_percent

#' Convert as percent (string)
#' 
#' Convert a numeric value into a string with percentage sign.
#' @param num Numeric vector to pass through
#' @param rounding Number of decimal places to round to. Default is 0.
#' @examples 
#' as_percent(.86748)
#' @export
as_percent <- function(num, rounding = 0){
  paste0(round(num * 100, rounding),"%")
}
martinctc/surveytools documentation built on Nov. 21, 2024, 10:48 p.m.