spatial.tools (version 1.6.0)

add_leading_zeroes: Add Leading Zeroes to a Numeric Vector

Description

Appends leading zeroes to a vector of numbers based on a string length or a maximum number.

Usage

add_leading_zeroes(number, number_length, max_number)

Arguments

number

A numeric vector.

number_length

The length of the output string.

max_number

A number to base the length of the output string on.

Value

A character vector.

Examples

Run this code
# NOT RUN {
x=c(1:10)
add_leading_zeroes(x,number_length=4)
add_leading_zeroes(x,max_number=10000)

# }

Run the code above in your browser using DataLab