makeLevsPadNums: make a set of levels that consist of a prefix combined with padded numeric values
Description
Makes a set of levels by combining a single string with strings
formed by either left- or right-padding of numeric values so that the
width of the padded string is at least ndigits. The prefix
and the padded string are combined using the function paste0.
If pad.char is "0", pad.direction is "right",
and there is a mixture of integers and reals, full stops will be added to the
integers as part of the padding process. Factor levels with a single-character
prefix and a sequence of padded integers from 1 to the number of levels are
often used as generic, abbreviated levels.
A warning is generated if there is more than one prefixstring or
non-numeric values are supplied to nums.
A vector of the same length as nums, provided only a
single prefix is provided.
Arguments
prefix
A string to use as the prefix to a set of padded numeric values.
nums
A vector of numeric values that are to be left- or right-padded
using str_pad_left or str_pad_right from the package
stringi. The width of the padded string will be at least
ndigits.
ndigits
An integer specifying the minimum width of the padded string
that is to be appended to the prefix.
pad.char
A string to use in padding the numeric values.
pad.direction
A string to specify whether to pad on the left or
the right.