wpgp/wopr

local query of agesex populations

Opened this issue · 2 comments

Hi,

I was trying to query only a single age-sex group using a local SQL database. In getPopSql() here: https://github.com/wpgp/wopr/blob/master/R/getPopSql.R#L73 the code collapses to a vector when agesex_select has a length of 1 (e.g. 'm0'). If you add the option drop = FALSE to the data frame that will preserve the 2 dimensional structure that apply expects. Happy to submit a quick pull request with the change, if you'd like.

Hi @edarin,

And a follow-up related question... is the standard/expected format for an age-sex table documented? Again when I'm using getPopSql() that same line of code (from above) is expecting row numbers to match the IDs of the table. Could there be a check for that or an option for a user to instead supply a column identifying the age-sex region? Thanks.

Ha - sorry I didn't get notified previously. I'm looking at it now.