socialcontactdata / contactmatrix

https://socialcontactdata.github.io/contactmatrix/
Other
3 stars 0 forks source link

Helper to obtain the age bins and breaks #21

Open joshwlambert opened 1 week ago

joshwlambert commented 1 week ago

In the design principles vignette it states:

Helper to obtain the age bins and breaks (if present) in terms of a vector with min or max ages, but also a text-format for figure labels etc.

Could you please explain what you're after from this point, what would be required that is different from contactmatrix::cm_get_groupings()?

Bisaloo commented 1 week ago

Good question!

contactmatrix::cm_get_groupings() returns the "text-format for figure labels etc.".

It may still be helpful to be able to get age groups as vectors. For the example provided in the docs:

https://github.com/socialcontactdata/contactmatrix/blob/a9ac05780f167d5b2f98da7bdceaa69a8b7171d6/R/contactmatrix.R#L32-L36

this would return

#> $lower
#> [1]  0  5 10 15
#> 
#> $higher
#> [1]  5 10 15 20

I can imagine this being particularly helpful if you have uneven age groups. But maybe I'm overthinking this and we don't need this at this time?

joshwlambert commented 1 week ago

Thanks for clarifying.

This might also relate to #10 if {ageutils} has functionality to do this. I've looking through the exported functions from {ageutils} and didn't see any functions that can currently do this, but may have missed it.

I'll tackle this issue and make a PR as I don't think it'll require lots of code. If you're questioning if it's worthwhile you can close the PR without merging.

To check, should the output from the code example above be as follows?

#> $lower
#> [1]  0  5 10 15
#> 
#> $higher
#> [1]  4 9 14 19
Bisaloo commented 1 week ago

To check, should the output from the code example above be as follows?

I'm not completely sure. This is one of the things where we probably need to be arbitrary and opinionated. Feel free to go with your favourite option.