numString: Integer to string converter

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Converts an integer into a string with a given digits. If necessary, the function prepends the number with zeros to fill the digits.

Usage

1
numString(x, n = 3)

Arguments

n

number of digits to be used.

Integer

to be converted to string.

Details

When creating numbered file names, the file system lists the files alphabetically. This is usually a nuisance since the listing is out of order: file_1, file_10, file_11, ..., file_2. This function makes it easy to create file names such as file_01, file_02, ..., file_09, file_10, file_11, ....

Value

String containing the number padded on its left with 0s n characters long.

Examples

1
2
print(numString(1:10, 2))
print(numString(1:10, 4))

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.