From c19ded45630d97900df40993f1cb6c6fcc38c31e Mon Sep 17 00:00:00 2001 From: Laura DeCicco <ldecicco@usgs.gov> Date: Thu, 5 Sep 2013 12:57:42 -0500 Subject: [PATCH] Fixed bug if number of digits already there was greater than what was being padded to. --- R/padVariable.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/padVariable.r b/R/padVariable.r index 740fd98c..b97c1915 100644 --- a/R/padVariable.r +++ b/R/padVariable.r @@ -12,7 +12,7 @@ #' correctPCode <- padVariable(pCode,5) padVariable <- function(x,padTo){ numDigits <- nchar(x) - if (padTo != numDigits){ + if ((padTo-numDigits)>0){ leadingZeros <- paste(rep("0",(padTo-numDigits)),collapse="",sep="") x <- paste(leadingZeros,x,sep="") } -- GitLab