Vanuatu-National-Statistics-Office / vnso-RAP-tradeStats-materials

A collection of scripts needed to develop a reproducible analytical pipeline for trade statistics
GNU General Public License v3.0
0 stars 1 forks source link

Avoid hard coding data into R code #79

Closed JosephCrispell closed 3 years ago

JosephCrispell commented 3 years ago

Hi @hugo-e-pigott,

Flagging this code below here to note that we should avoid hard coding data into our code. Hard-coding data means it is difficult to update if there data changes, individual errors can be introduced and sensitive data might be accidentally added into the code.

https://github.com/Vanuatu-National-Statistics-Office/vnso-RAP-tradeStats-materials/blob/da269cd5b5c0b41440cf8ee350262a280ad5c542/R/MonthlyReportAndTables/3_buildMonthlyReport.Rmd#L123

I'd recommend either connecting to the SQL server for historic data and calculating or build csv files with the data created with R/SQL code that is stored in the repo. I prefer the second method as it means the data are only generated once save computational time in this case because the historic data are unlikely to change only when an error is spotted and corrected.

Joe