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

Event table update #45

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Event table update #45

wants to merge 10 commits into from

Conversation

guangguangzai
Copy link
Collaborator

Added 3 functions of generate event tables; added 2 tests.

@guangguangzai guangguangzai marked this pull request as draft February 4, 2025 16:46
@guangguangzai guangguangzai marked this pull request as ready for review February 4, 2025 21:48
Copy link
Collaborator

@LittleBeannie LittleBeannie left a comment

Choose a reason for hiding this comment

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

Hi @guangguangzai, thank you for moving this forward! A lot of work has been done. Please take a look at the following 19 comments before our meeting and get the east ones fixed. Then we could focus on the more challenging comments when we meet this week.

@@ -0,0 +1,64 @@
#' generate event table in common control
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change the file name to the function name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to generate_event_table_cc

@@ -0,0 +1,64 @@
#' generate event table in common control
#'
#' @param input_data input data in common control situation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please be more specific of input_data and hypothesis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

#' @param input_data input data in common control situation
#' @param hypothesis comparison group
#'
#' @return
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the return.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

#' @examples
#' input_data <- data.frame(
#' Population = c("Experimental 1", "Experimental 2", "Experimental 3", "Control"),
#' IA = c(70, 75, 80, 85),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a comment explaining what the physical meaning of 70, 75, 80, and 85.

#' )
#'
#' result_table <- generate_event_table_cc(input_data, hypothesis)
#' sorted_data <- result_table[order(result_table$analysis), ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the output of generate_event_table_cc is sorted. Could you please check if there is a specific reason why the sorted_data is required in the example?

#' # Generate event table using the updated function
#' result_table <- generate_event_table(input_data, hypothesis, type = "common_control")
#'
#' # Sort the result table by analysis
Copy link
Collaborator

Choose a reason for hiding this comment

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

Echo with my previous comment: could you please check if the sort required?

#' # ------------------------ Example of overall population
#' input_data <- data.frame(
#' Population = c("Population 1", "Population 2", "Population 1 Intersection 2", "Overall population"),
#' IA = c(100, 110, 80, 225),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a comment explaining the physical meaning of 100, 110, 80, 225.

#' # Generate event table using the updated function
#' result_table <- generate_event_table(input_data, hypothesis, type = "overlap_population")
#'
#' # Sort the result table by analysis
Copy link
Collaborator

Choose a reason for hiding this comment

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

Echo with my previous comment: could you please check if the sort required?

} else if (type == "overlap_population") {
result_df <- generate_event_table_ol(input_data, hypothesis) # see generate_event_ol_addhypo.R
}
result_df <- result_df[!duplicated(result_df), ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the output is already sorted in generate_event_table_cc and generate_event_table_ol. Is the line 71-73 may duplicated?

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

Successfully merging this pull request may close these issues.

2 participants