Learn R Programming

easyPubMed (version 3.1.6)

EPM_zerofill: 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")

Value

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

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.

Author

Damiano Fantini, damiano.fantini@gmail.com

References

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

Examples

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


Run the code above in your browser using DataLab