what is the more elegant way of just using sprintf without the gsub for this line of code?
sprintf
gsub
gsub(\" \",\"0\",sprintf(\"%2.d\", 0:15)) [1
Use a 0 in the format string to pad with leading zeros instead of spaces: sprintf("%02d", 0:15)
0
sprintf("%02d", 0:15)