leadZeros {mutSignatures} | R Documentation |
Add Leading Zeros to Numbers.
Description
Internal function to convert a numeric vector into a character vector, where all elements have the same number of characters (nchar). This is obtained by pasting a series of leading zeros (or other character) to each number in the input vector.
Usage
leadZeros(n, m, char = "0", na.value = NA)
Arguments
n |
numeric vector whose numbers are to be transformed |
m |
maximum number that will be used to define how many leading zeros to attach |
char |
string (typically, a single character). This character is used to fill the leading space. Defaults to 0. |
na.value |
value used to fill mising values. Defaults to NA |
Details
This is one of the core functions included in the original mutSignatures R library, and in the WTSI MATLAB framework. This is an internal function.
Value
numeric vector of length equal to length(n), where all numbers are converted to character and modified by attaching the required number of leading zeros (characters).
Author(s)
Damiano Fantini, damiano.fantini@gmail.com
References
More information and examples about mutational signature analysis can be found here:
-
GitHub Repo: https://github.com/dami82/mutSignatures/
-
More info and examples about the mutSignatures R library: https://www.data-pulse.com/dev_site/mutsignatures/
-
Sci Rep paper, introducing mutS: https://www.nature.com/articles/s41598-020-75062-0/
-
Oncogene paper, Mutational Signatures Operative in Bladder Cancer: https://www.nature.com/articles/s41388-017-0099-6
WTSI framework: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3588146/
Examples
n = c(5:12, NA, 9:11)
m = 111
mutSignatures:::leadZeros(n=n, m=m)