ropensci-archive / bomrang

:warning: ARCHIVED :warning: Australian government Bureau of Meteorology (BOM) data client for R
Other
109 stars 26 forks source link

0-pad station number in output to 6 characters #128

Closed jonocarroll closed 3 years ago

jonocarroll commented 3 years ago

Per #127 the station_number column returned in get_historical_weather() does not match the station_id used elsewhere. The cause is the data itself where the station column is stored without leading 0s, e.g. IDCJAC0009_023000_1800_Data.csv.

This solution is to left-pad the station_number output with 0 to fill 6 characters. Is that the appropriate format for other station_ids?

adamhsparks commented 3 years ago

Yes, best I can tell the station IDs should be six chars with one or two leading "0"s which R lops off if it's not formatted as a character value.

I've learned something new with your PR using the sprintf() as you have here. 🙏 Useful!