-
Notifications
You must be signed in to change notification settings - Fork 2
Add Dunnett-type 4-dose GSD vignette and bump version to 0.3.0 #52
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f39a49d
Initial S7 class EventTable added using Sonnet 4
keaven 16386a0
Style code (GHA)
keaven ea0f4ce
Release v0.2.0: Complete S7 class system implementation
keaven d01f9a9
Release v0.2.0: Add S7 class system with EventTable and CorrelationMa…
keaven 0b8842d
Fix package build issues and documentation
keaven baf9fe5
Release v0.2.0: Major S7 integration and vignette improvements
keaven a072543
Minor vignette formatting improvement
keaven 282ea49
feat: Complete S7 wrapper function elimination and validation refacto…
keaven 8c7e25e
fix: Remove empty adj-seq-p-simplified.Rmd vignette causing UNKNOWN T…
keaven e59abbf
feat: Organize help files in logical sections for better usability
keaven e2244f4
Style code (GHA)
keaven 2b77d64
Add Dunnett-type 4-dose GSD vignette with correlation verification
keaven a449358
Bump version to 0.3.0
keaven 4d951fd
Fix S7 EventTable validation and update NEWS.md for v0.3.0
keaven dc64376
Style code (GHA)
keaven 4c4ffb2
Fix R CMD check documentation errors and warnings
keaven f935da5
Style code (GHA)
keaven 234aacd
Add EventTable to pkgdown reference index
keaven 1620b6f
Fix generate_corr() for K>2 analyses and rewrite Dunnett vignette
keaven File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| * using log directory ‘/Users/Anderkea/Documents/GitHub/wpgsd/..Rcheck’ | ||
| * using R version 4.5.0 (2025-04-11) | ||
| * using platform: aarch64-apple-darwin20 | ||
| * R was compiled by | ||
| Apple clang version 14.0.0 (clang-1400.0.29.202) | ||
| GNU Fortran (GCC) 14.2.0 | ||
| * running under: macOS Sequoia 15.6.1 | ||
| * using session charset: UTF-8 | ||
| * using option ‘--no-manual’ | ||
| * checking for file ‘./DESCRIPTION’ ... ERROR | ||
| Required fields missing or empty: | ||
| ‘Author’ ‘Maintainer’ | ||
| * DONE | ||
| Status: 1 ERROR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,5 @@ | |
| ^\.github$ | ||
| ^codecov\.yml$ | ||
| ^CITATION\.cff$ | ||
| ^doc$ | ||
| ^Meta$ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,5 @@ | |
| .Ruserdata | ||
| .DS_Store | ||
| docs | ||
| /doc/ | ||
| /Meta/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # EventTable S7 Class Implementation | ||
|
|
||
| ## Overview | ||
|
|
||
| The `EventTable` S7 class provides a type-safe, validated data structure for representing event count data used in the wpgsd package. This is the first step in converting the wpgsd package to use S7 classes throughout. | ||
|
|
||
| ## Features | ||
|
|
||
| ### Core Properties | ||
| - **data**: A tibble containing the event count data with required columns `H1`, `H2`, `Analysis`, `Event` | ||
| - **n_hypotheses**: Automatically calculated number of hypotheses | ||
| - **n_analyses**: Automatically calculated number of analyses | ||
|
|
||
| ### Validation | ||
| - Validates presence of required columns (`H1`, `H2`, `Analysis`, `Event`) | ||
| - Ensures proper data types (all numeric) | ||
| - Validates logical constraints: | ||
| - Hypothesis indices must be positive integers | ||
| - Analysis numbers must be positive integers | ||
| - Event counts must be non-negative | ||
| - Enforces mathematical consistency requirements: | ||
| - For a fixed H1, H2 pair, Event counts must be non-decreasing as Analysis increases | ||
| - For off-diagonal entries (H1 ≠ H2), diagonal entries must exist with Event ≥ off-diagonal Event for the same Analysis | ||
| - These constraints ensure proper mathematical properties for correlation matrix calculations | ||
|
|
||
| ### Methods | ||
| - **print()**: Clean formatted output showing key information | ||
| - **summary()**: Detailed summary including event count statistics | ||
| - **subset_event_table()**: Subset by analysis or hypotheses | ||
| - **as_event_table()**: Convert tibble to EventTable | ||
| - **validate_event_table_data()**: Validate data format before processing | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ### Basic Usage | ||
| ```r | ||
| library(wpgsd) | ||
|
|
||
| # Create event data | ||
| event_data <- tibble::tribble( | ||
| ~H1, ~H2, ~Analysis, ~Event, | ||
| 1, 1, 1, 155, | ||
| 2, 2, 1, 160, | ||
| 1, 2, 1, 85, | ||
| 1, 1, 2, 305, | ||
| 2, 2, 2, 320, | ||
| 1, 2, 2, 170 | ||
| ) | ||
|
|
||
| # Create EventTable object | ||
| event_table <- EventTable(data = event_data) | ||
| print(event_table) | ||
| ``` | ||
|
|
||
| ### Data Validation | ||
| ```r | ||
| # The constructor automatically validates data | ||
| tryCatch({ | ||
| invalid_data <- tibble::tibble( | ||
| H1 = c(1, -2), # Invalid: negative hypothesis index | ||
| H2 = c(1, 2), | ||
| Analysis = c(1, 1), | ||
| Event = c(100, 200) | ||
| ) | ||
| EventTable(data = invalid_data) | ||
| }, error = function(e) { | ||
| cat("Validation error:", e$message) | ||
| }) | ||
| ``` | ||
|
|
||
| ### Subsetting | ||
| ```r | ||
| # Subset by analysis | ||
| analysis_1 <- subset_event_table(event_table, analysis = 1) | ||
|
|
||
| # Subset by hypotheses | ||
| h1_h2 <- subset_event_table(event_table, hypotheses = c(1, 2)) | ||
| ``` | ||
|
|
||
| ### Integration with Existing Functions | ||
| ```r | ||
| # Use with existing wpgsd functions | ||
| correlation_matrix <- generate_corr(event_table@data) | ||
| ``` | ||
|
|
||
| ## Files Created | ||
|
|
||
| - `R/s7_classes.R`: Main S7 class definition | ||
| - `tests/testthat/test-s7-event-table.R`: Comprehensive unit tests | ||
| - `examples/test_event_table.R`: Basic usage examples | ||
| - `examples/event_table_integration.R`: Integration with existing functions | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - Added `S7` to package imports in `DESCRIPTION` | ||
| - Uses existing dependencies: `tibble`, `dplyr` | ||
|
|
||
| ## Benefits | ||
|
|
||
| 1. **Type Safety**: Prevents invalid data from being passed to wpgsd functions | ||
| 2. **Validation**: Automatic validation of data format and constraints | ||
| 3. **Documentation**: Self-documenting data structures | ||
| 4. **Method Dispatch**: Extensible with specialized methods | ||
| 5. **User Experience**: Clear error messages and helpful summaries | ||
|
|
||
| ## Next Steps | ||
|
|
||
| This EventTable implementation provides the foundation for converting the wpgsd package to S7 classes. Future steps include: | ||
|
|
||
| 1. Create `CorrelationMatrix` S7 class for `generate_corr()` output | ||
| 2. Create `Bounds` S7 class for `generate_bounds()` output | ||
| 3. Update existing functions to accept/return S7 objects | ||
| 4. Maintain backward compatibility with existing tibble/data.frame inputs | ||
|
|
||
| ## Testing | ||
|
|
||
| Run the comprehensive test suite: | ||
| ```r | ||
| testthat::test_file("tests/testthat/test-s7-event-table.R") | ||
| ``` | ||
|
|
||
| The tests cover: | ||
| - Object creation with valid data | ||
| - Validation of required columns | ||
| - Data type and value validation | ||
| - Print and summary methods | ||
| - Subsetting functionality | ||
| - Data conversion utilities |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,17 +2,40 @@ | |
|
|
||
| export(":=") | ||
| export(.data) | ||
| export(CorrelationMatrix) | ||
| export(EventTable) | ||
| export(as_correlation_matrix) | ||
| export(as_event_table) | ||
| export(as_label) | ||
| export(as_name) | ||
| export(calc_seq_p) | ||
| export(check_event_data) | ||
| export(closed_test) | ||
| export(compute_correlations) | ||
| export(enquo) | ||
| export(enquos) | ||
| export(find_astar) | ||
| export(find_xi) | ||
| export(gen_corr) | ||
| export(generate_bounds) | ||
| export(generate_corr) | ||
| export(generate_corr_s7) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this PR did not replace the existing |
||
| export(generate_event_table) | ||
| export(generate_event_table_) | ||
| export(generate_event_table_cc) | ||
| export(generate_event_table_ol) | ||
| export(subset_correlation_matrix) | ||
| export(subset_event_table) | ||
| export(validate_event_table_data) | ||
| importFrom(S7,S7_inherits) | ||
| importFrom(S7,S7_object) | ||
| importFrom(S7,class_character) | ||
| importFrom(S7,class_data.frame) | ||
| importFrom(S7,class_integer) | ||
| importFrom(S7,method) | ||
| importFrom(S7,new_S3_class) | ||
| importFrom(S7,new_class) | ||
| importFrom(S7,new_object) | ||
| importFrom(dplyr,"%>%") | ||
| importFrom(dplyr,arrange) | ||
| importFrom(dplyr,bind_rows) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shall we get rid of this log file and its ..Rcheck folder?
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.
Done in #54