R tricks >

Format a number with leading zeros

x <- seq(3)
sprintf("%05d", x)