sprintfcan be used to merge the dataset into a singular string, specifying thefmt. To incorporate Leading zeros , generate a condition inifelsethat produces the new format when-is present, otherwise the old format will be returned.
adding regression line per group with ggplot2I'm not quite sure whether that's what you want, but have you tried the following?