adding regression line per group with ggplot2I'm not quite sure whether that's what you want, but have you tried the following?
use sprintf to join back into a single string specifying the fmt for adding the leading zeros, create the condition in ifelse to return that new format when there is - or else the old one.