I am trying to write functions in R where the aim is to read multiple .csv files. They are named as 001.csv, 002.csv, ... 332.csv.
With paste
I managed to construct names 1.csv, 2.csv and so on, but I'm having difficulty with adding leading zeroes. There's a hint that the construction like sprintf("%03d", 7)
is required, but I have no idea why and how this works.
So can somebody explain what the following statement can actually does?