View source: R/AddLeadingZeros.R
AddLeadingZeros | R Documentation |
This function is created to fix problems caused by a serious bug in Excel. Editing csv files in that program causes leading zeros to disappear.
AddLeadingZeros(
codes,
places,
warningText = NULL,
viaFactor = TRUE,
nWarning = 6,
removeLeadingTrailingWhitespace = TRUE
)
codes |
Character vector |
places |
Number of places for positive numbers. Minus sign is extra |
warningText |
When non-NULL, warning will be produced |
viaFactor |
When TRUE, the algorithm uses factor coding internally. |
nWarning |
Number of elements to be written before ... in warnings. |
removeLeadingTrailingWhitespace |
Remove leading and trailing whitespace |
Character vector
Øyvind Langsrud
AddLeadingZeros(c("1", "ABC", "12345", " 23", "-8", "45 ", " -9", " Agent ", "007",
"7 James Bond "), 10)
AddLeadingZeros(c("1", "ABC", "12345", " 23", "-8", "45 ", " -9", " Agent ", "007",
"7 James Bond "), 4)
AddLeadingZeros(c("1", "ABC", "12345", " 23", "-8", "45 ", " -9", " Agent ", "007",
"7 James Bond "), 4, removeLeadingTrailingWhitespace = FALSE)
AddLeadingZeros(c("1", "ABC", "12345", " 23", "-8", "45 ", " -9", " Agent ", "007",
"7 James Bond "), 4, warningText = "string changes")
AddLeadingZeros(c("1", "ABC", "12345", " 23", "-8", "45 ", " -9", " Agent ", "007",
"7 James Bond "), 4, warningText = "", nWarning = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.