-
Notifications
You must be signed in to change notification settings - Fork 6
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
Brittany/post processing quantiles #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chaneg looks ok to me, just add some thoughts about the code below.
FYI if you need to build a new release with zip file in it, you will need to change version in DESCRIPTION (not necessary if you just work off main branch for now)
.( | ||
CI05 = quantile(TotHrs, probs = c(.05)), | ||
CI25 = quantile(TotHrs, probs = c(.25)), | ||
MeanHrs = mean(TotHrs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems CI50 and MeanHrs are the same thing? just curios as they are both used
@@ -255,35 +255,35 @@ TaskTimesGroup <- function(taskIDs, years, weeksPerYear = 48){ | |||
if (label == "adults 31-44") { | |||
return(sum(pop$Female[32:45] + pop$Male[32:45])) | |||
} | |||
if (label == "women 20-30") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to use case-switch logic which may be easier to maintain also generally faster than if-else
examples like this
@celiot-IDM what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a sensible suggestion, but I'm going to suggest that what we really want is to somehow make population range labels configurable from the input spreadsheet. This would reduce the number of common maintenance tasks that require coding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS I also hate the look of a long line of if-statements, but it's super-easy to understand, and once I realized this was the part of the code most likely to be edited by researchers, I opted for the less elegant (but easy to understand) approach over the more compact switch-statement.
But as I mention in the previous comment, I don't think either approach is best.
Two updates:
Added quantile calculations to the post-processing summaries to extend the analyses that are possible.
Corrected the age bins to not be overlapping.