| makeLevsPadNums | R Documentation |
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 prefix string or
non-numeric values are supplied to nums.
makeLevsPadNums(prefix, nums, ndigits = 2, pad.char = "0", pad.direction = "left")
prefix |
A |
nums |
A |
ndigits |
An |
pad.char |
A |
pad.direction |
A |
A vector of the same length as nums, provided only a
single prefix is provided.
Chris Brien
stringi::stri_pad_left, stringi::stri_pad_right.
treat.levs <- makeLevsPadNums("T", 1:12)
treat.levs <- makeLevsPadNums("T", seq(0.0, 2.5, 0.5), ndigits = 3, pad.dir = "r")
levs <- makeLevsPadNums("", 1:12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.