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

Added counts with percentages option to summary function in Describe > Specific Tables/Graphs > Summary Tables dialog #7784

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

lilyclements
Copy link
Contributor

@lilyclements lilyclements commented Aug 17, 2022

@africanmathsinitiative/developers @rdstern this is ready to review.

This PR adds a parameter to include counts with percentages in summary function called include_counts_with_percentage as discussed in #7621.
This is default FALSE, but when TRUE, includes the counts when percentages are chosen.

E.g.

survey <- data_book$get_data_frame(data_name="survey")
multiple_receiver_cols <- c("village", "variety")
list_of_tables  <- survey %>% purrr::map(.x=multiple_receiver_cols,
                                         .f= ~ dplyr::select(.data=data_book$summary_table(data_name="survey", percentage_type="factors", perc_total_factors="fertgrp",
                                                                                           include_counts_with_percentage = TRUE,
                                                                                           summaries=c("summary_count"), include_margins = TRUE, factors=c("fertgrp", .x)), c(1, by_var=2, 3, 4))) %>% purrr::map(.x=., .f= ~ mmtable2::mmtable(data=.x, cells=value) + mmtable2::header_top_left(variable='by_var') + mmtable2::header_left_top(variable="fertgrp"))

gives:
image

Whereas

survey <- data_book$get_data_frame(data_name="survey")
multiple_receiver_cols <- c("village", "variety")
list_of_tables  <- survey %>% purrr::map(.x=multiple_receiver_cols,
                                         .f= ~ dplyr::select(.data=data_book$summary_table(data_name="survey", percentage_type="factors", perc_total_factors="fertgrp",
                                                                                           summaries=c("summary_count"), include_margins = TRUE, factors=c("fertgrp", .x)), c(1, by_var=2, 3, 4))) %>% purrr::map(.x=., .f= ~ mmtable2::mmtable(data=.x, cells=value) + mmtable2::header_top_left(variable='by_var') + mmtable2::header_left_top(variable="fertgrp"))

gives:
image

@lloyddewit
Copy link
Contributor

@rdstern if you can test/approve, then we can merge
@lilyclements is there an R developer who should peer review this PR?
Thanks

@lilyclements
Copy link
Contributor Author

@N-thony who do you suggest should peer review this PR?

Copy link
Collaborator

@N-thony N-thony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lloyddewit even though I'm not strong in R but I did a quick look of this with Lily and I'm convinced everything is okay. Over to you.

@lloyddewit
Copy link
Contributor

@N-thony thank you for the review.
@rdstern if you can test/approve, then we can merge, thanks

Copy link
Collaborator

@rdstern rdstern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lloyddewit I am happy to approve if the code is ok, but I can't check, until the dialogue is changed to allow more than one of these summaries to be included. @lilyclements I wonder who will do this - perhaps choose someone at the workshop this week?

@lilyclements lilyclements deleted the edits_table branch September 10, 2022 12:21
@lloyddewit
Copy link
Contributor

@lilyclements what's the reason you closed this? do you plan to implement in a new PR? thanks

@lilyclements lilyclements restored the edits_table branch September 12, 2022 09:50
@lilyclements lilyclements reopened this Sep 12, 2022
@lilyclements
Copy link
Contributor Author

@lilyclements what's the reason you closed this? do you plan to implement in a new PR? thanks

@lloyddewit Ah was an accident when deleting old branches! Thanks for pointing this one out!

@lloyddewit lloyddewit changed the title Parameter to include counts with percentages in summary function Added counts with percentages option to summary function in Describe > Specific Tables/Graphs > Summary Tables dialog Sep 13, 2022
@lloyddewit lloyddewit merged commit bb3dba0 into IDEMSInternational:master Sep 13, 2022
@lilyclements lilyclements deleted the edits_table branch March 9, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants