I have a set of data which looks something like this:
anim <- c(25499,25500,25501,25502,25503,25504) sex <- c(1,2,2,1,2,1) wt <- c(0.8,1.2,1.0,2.
str_pad from the stringr package is an alternative.
str_pad
stringr
anim = 25499:25504 str_pad(anim, width=6, pad="0")