r - Put '00's in front of integers based on how large the number is? -
i have vector of calendar days such vec_day
vec_day<- c(8,14,365,9) vec_day [1] 8 14 365 9 i transform vec_day2
vec_day2 [1] "008" "014" "365" "009" it can either string or vector
vec_day2 <- sprintf("%03d", vec_day) [1] "008" "014" "365" "009"
Comments
Post a Comment