EPM_zerofill: Harmonize the Elements of a Vector by Adding Leading Zeros.

View source: R/epm_all_fx.R

EPM_zerofillR Documentation

Harmonize the Elements of a Vector by Adding Leading Zeros.

Description

Coerce a vector to character and then harmonize the number of characters (nchar) of each element by adding a suitable number of leading zeroes (or other user-character).

Usage

EPM_zerofill(x, fillchar = "0")

Arguments

x

vector (numeric or character).

fillchar

string corresponding to a single character. This character is going to be added (one or more times) in front of each element of the input vector.

Value

character vector whose elements have all the same size (number of characters).

Author(s)

Damiano Fantini, damiano.fantini@gmail.com

References

https://www.data-pulse.com/dev_site/easypubmed/

Examples

# Example 1
easyPubMed:::EPM_zerofill(c(1, 100, 1000))
# Example 2
easyPubMed:::EPM_zerofill(c('Hey,', 'hello', 'there!'), '_')



dami82/easyPubMed documentation built on Jan. 4, 2024, 6:21 a.m.