Closed adam3smith closed 3 years ago
Nice work on this @mccallc ! Do you think we could simplify this further? I'm thinking something along the lines of
for (source in sources) {
results <- eval(parse(text = paste0('rbind.data.frame(results, ', source, '_standardize(keywords, from_year, to_year))')))
}
i.e. automatically generate the function name
I knew there had to be a way to dynamically interpret function names. This is definitely the most elegant and scalable solution. I'll move date handling and multiple keyword looping to the source R files from main.R
so all the *_standardize()
functions can handle the exact same input, then this should be feasible
Fully implemented in commit 0a323b8f563e9f926e1ebdf9ba14eb4387b6d874
As per discussion on 2/8: Restructure the apis.R function to be a simple loop/lapply through all sources and move the code that standardizes output into a separate function in the same file as the
api_get
function. So, e.g., thearnold.R
file would contain two functions:arnold_get()
andarnold_standardize()
.