mrc-ide / demogsurv

Analysis of demographic indicators from Demographic and Health Surveys (DHS) and other household surveys
6 stars 3 forks source link

Move 'batch_size' argument usage to `demog_pyears` function. #17

Open chacalle opened 2 years ago

chacalle commented 2 years ago

Hi Jeff.

Similar to #15 I was getting an error when trying to calculate fertility rates from large surveys.

I saw this commit message and attempted the refactor to use batch_size within the demog_pyears function. I also added the batch_size argument to calc_asfr and calc_tfr.

If you think users are directly using demog_pyears we could add an argument like data.frame=FALSE to preserve the original return format by default?

This was the original error I was getting in my use case.

Error in pyears(formula, data, scale = scale, data.frame = TRUE, weights = weights) :
  long vectors (argument 11) are not supported in .C

I tested that this passed the package checks on my local machine