SpaDES (version 1.2.0)

paddedFloatToChar: Convert numeric to character with padding

Description

Convert numeric to character with padding

Usage

paddedFloatToChar(x, padL = ceiling(log10(x + 1)), padR = 3, pad = "0")

Arguments

x
numeric. Number to be converted to character with padding
padL
numeric. Desired number of digits on left side of decimal. If not enough, pad will be used to pad.
padR
numeric. Desired number of digits on right side of decimal. If not enough, pad will be used to pad.
pad
character to use as padding (nchar(pad)==1 must be TRUE). Passed to str_pad

Value

Character string representing the filename.

Examples

Run this code
paddedFloatToChar(1.25)
paddedFloatToChar(1.25, padL = 3, padR = 5)

Run the code above in your browser using DataCamp Workspace