Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential weak point in a function #3

Open
rhi-batstone opened this issue Sep 8, 2021 · 0 comments
Open

Potential weak point in a function #3

rhi-batstone opened this issue Sep 8, 2021 · 0 comments

Comments

@rhi-batstone
Copy link
Contributor

Function to create table: Total by sex and year used on the births and deaths datasets: https://github.com/DataScienceScotland/council_area_profiles/blob/7943638a8de52cbcff000f99e589793102d09f0e/34_tables.R#L147-L159

This function uses the min year from the births data. This will be a problem if the births dataset is behind or ahead the deaths dataset. (line 155 & 156)
The function can probably be made more robust by calculating the min year within the function rather than using the variable already created for births start/min year e.g.:

mutate(Perc = ((Total - Total[Year == min(dataset[["Registration Year"]])]) / 
                      Total[Year == min(dataset[["Registration Year"]])]) * 100) %>% 

If the births and deaths data is guaranteed to be updated at the same time then this issue can be disregarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant