zeroPad | R Documentation |
Function to pad a string with leading zeros. Useful for parameter codes and USGS site IDs.
zeroPad(x, padTo)
x |
character |
padTo |
number Final desired length of the character |
x character returned with leading zeros
pCode <- "10"
correctPCode <- zeroPad(pCode, 5)
pCodes <- c("100", "1000", "0", "12345", "1565465465465465")
correctPCodes <- zeroPad(pCodes, 5)
pCodeNA <- c(1, 2, NA)
padPCodeNA <- zeroPad(pCodeNA, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.