pct_to_str: Percent to string

View source: R/helpers.R

pct_to_strR Documentation

Percent to string

Description

This function takes a vector of numerical values you want to convert into a percentage and creates a character vector with the '

Usage

pct_to_str(x, digits = 1, check_bounds = TRUE)

Arguments

x

a numerical vector to convert

digits

the number of digits to include in the converted percentage

check_bounds

logical. If true, will require that 0 <= x <= 1. This is to protect against accidental conversions.

Examples

## Not run: 
 x <- seq(0, 1, .1)
 y <- pct_to_str(x, 1)

 #set check_bounds = FALSE to convert values outside of 0 <= x <= 1
 x <- c(1.0, 1.1)
 y <- pct_to_str(x, 1, check_bounds = FALSE)

## End(Not run)


ekholme/eemisc documentation built on May 30, 2022, 6:34 p.m.