Add Dunnett-type 4-dose GSD vignette and bump version to 0.3.0#52
Add Dunnett-type 4-dose GSD vignette and bump version to 0.3.0#52
Conversation
- Add EventTable and CorrelationMatrix S7 classes with type safety and validation - Implement generate_corr_s7() with EventTable input and proper column ordering - Update vignettes with S7 examples and improved math typesetting - Reorganize pkgdown reference documentation for better discoverability - Maintain full backward compatibility with existing functions - Add comprehensive test suite (105+ tests) covering all S7 functionality - Update NEWS.md with detailed release notes for v0.2.0
…trix - Add S7 class system for enhanced type safety and validation - Implement EventTable S7 class with comprehensive data validation - Implement CorrelationMatrix S7 class with mathematical constraints - Add generate_corr_s7() function with EventTable input and proper column ordering - Add S7 constructors, converters, and utility functions - Update vignettes with S7 examples and improved math formatting - Reorganize pkgdown reference documentation with logical groupings - Maintain full backward compatibility with existing functions - Add comprehensive test suite (105+ tests) - Update NEWS.md with detailed release notes
- Fixed correlation matrix symmetry validation tolerance (1e-12 with check.attributes=FALSE) - Removed non-ASCII character from print method (× to x) - Renamed non-portable filename: s7 prompts.md -> s7_prompts.md - Added missing @export for generate_event_table_cc function - Added EventTable to package exports - Simplified roxygen documentation to avoid parsing issues - All 132 unit tests passing - Package builds and installs successfully - pkgdown documentation site updated
- Implement complete S7 class system with EventTable and CorrelationMatrix classes - Add robust validation for correlation matrices and event data - Fix correlation matrix validation tolerance issues (1e-12 precision) - Resolve non-ASCII character issues in documentation - Add missing @export tags for proper function exports - Significantly improve adj-seq-p vignette with 80% code reduction - Add systematic helper functions for better maintainability - Enhanced mathematical notation and multiplicity strategy visualization - Add comprehensive citations and improved explanations - Update NEWS.md with detailed changelog for v0.2.0 - All 132 tests passing with enhanced test coverage - Complete documentation and pkgdown site generation
Add blank line before bullet points for better readability in adj-seq-p vignette
…ring - Remove redundant wrapper functions new_event_table() and new_correlation_matrix() - Enhance S7 class documentation with comprehensive parameter descriptions - Consolidate validation logic into validate_event_data_core() eliminating ~80% duplication - Update all examples, tests, and documentation to use direct S7 constructors - Relax Event validation to allow non-integer values while maintaining H1/H2/Analysis as integers - Regenerate package documentation and fix NAMESPACE exports - Update pkgdown configuration to reflect API changes - Add comprehensive NEWS.md documentation for v0.2.0 changes Improves code maintainability and follows S7 best practices for class documentation.
…ITLE in navigation - Deleted empty vignettes/adj-seq-p-simplified.Rmd file (0 bytes) - Removed corresponding docs/articles/adj-seq-p-simplified.html - Rebuilt pkgdown site to fix navigation dropdown - Resolves UNKNOWN TITLE issue in Articles menu
- Added structured reference sections to _pkgdown.yml: * S7 Classes and Constructors * Event Table Generation * Correlation Matrix Computation * Statistical Testing and Analysis * Data Manipulation and Subsetting * Data Validation * Utility Functions * Package Information - Improves user experience by grouping related functions together - Reference documentation now displays functions in logical categories
- Fix validator to allow single-analysis/hypothesis EventTables - Guard floor() calls with is.numeric checks - Fix paste/paste0 inconsistency in error messages - Correct test expectations to match actual error messages - Add NEWS.md entry for v0.3.0
|
Here is a prompt you can use to clean things up: |
- Fix duplicate/merged roxygen blocks in s7_classes.R and compute_correlations.R - Add @name tags for S7 class definitions (EventTable, CorrelationMatrix) - Separate @importFrom block from EventTable roxygen with NULL - Remove orphaned validate_event_data_core roxygen block from s7_classes.R - Fix stray backtick in @param event in generate_event_table_.R and generate_event_ol.R - Fix EventTable example data to be valid (complete event table) - Regenerate all affected Rd files
- Fix within-hypothesis and between-hypotheses correlation loops in generate_corr() to correctly enumerate all analysis pairs when K>2 - Add test for generate_corr() with 2 hypotheses and 3 analyses - Rewrite Dunnett vignette: 2 doses / 3 analyses (2 interims + final) instead of 4 doses / 2 analyses, exercising full K>2 generality - Update NEWS.md with bug fix and vignette changes
There was a problem hiding this comment.
Shall we get rid of this log file and its ..Rcheck folder?
| @@ -0,0 +1,71 @@ | |||
| # Example integration of EventTable S7 class with existing wpgsd functions | |||
There was a problem hiding this comment.
Please add the following header at the begining of this file.
# Copyright (c) 2026 Merck & Co., Inc., Rahway, NJ, USA and its affiliates.
# All rights reserved.
#
# This file is part of the wpgsd program.
#
# wpgsd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
There was a problem hiding this comment.
Would you like to keep this file when we submit to CRAN?
There was a problem hiding this comment.
I added inst/aiprompts/ to .Rbuildignore in #54
|
|
||
| #' Compute correlations from event data | ||
| #' | ||
| #' @description |
There was a problem hiding this comment.
Could you please explain the difference between this new function compute_correlations() and the existing function generate_corr()?
| } | ||
| } | ||
|
|
||
| #' Convert correlation data frame to correlation matrix |
There was a problem hiding this comment.
I have a couple of questions about the correlation data frame (corr_df) that I hope you can clarify.
- Meaning of H1 and H2 Columns: In the example, the corr_df has columns H1 = 2 and H2 = 1. After reviewing the code, my understanding is that this specifies the correlation between H2 and H1. Is this interpretation correct? If so, it might be beneficial for other users if the documentation for the
@param corr_dfcould be updated to explain this relationship more explicitly. - Clarification on the
Correlationcolumn: I am also a bit confused about theCorrelationcolumn withincorr_df. Could you please explain how the value in this column differs from the correlation matrix that is generated by thegen_corrfunction? Understanding the distinction would be very helpful.
There was a problem hiding this comment.
Shall we remove the entire wpgsd.Rcheck folder?
jdblischak
left a comment
There was a problem hiding this comment.
I addressed many of Nan's suggestions in #54
| # Example integration of EventTable S7 class with existing wpgsd functions | ||
| # This shows how EventTable can work with generate_corr() | ||
|
|
||
| library(wpgsd) | ||
| library(tibble) | ||
|
|
||
| # Example 1: Using EventTable with generate_corr() | ||
| # Create event data using the EventTable class | ||
| event_data_raw <- tibble::tribble( | ||
| ~H1, ~H2, ~Analysis, ~Event, | ||
| 1, 1, 1, 155, | ||
| 2, 2, 1, 160, | ||
| 3, 3, 1, 165, | ||
| 1, 2, 1, 85, | ||
| 1, 3, 1, 85, | ||
| 2, 3, 1, 85, | ||
| 1, 1, 2, 305, | ||
| 2, 2, 2, 320, | ||
| 3, 3, 2, 335, | ||
| 1, 2, 2, 170, | ||
| 1, 3, 2, 170, | ||
| 2, 3, 2, 170 | ||
| ) | ||
|
|
||
| # Create EventTable object | ||
| event_table <- EventTable(data = event_data_raw) | ||
| print("Created EventTable:") | ||
| print(event_table) | ||
|
|
||
| # Use with generate_corr (currently expects tibble/data.frame) | ||
| # The @data slot extracts the underlying tibble | ||
| correlation_matrix <- generate_corr(event_table@data) | ||
| print("Generated correlation matrix:") | ||
| print(correlation_matrix) | ||
|
|
||
| # Example 2: Data validation before processing | ||
| cat("\nExample 2: Data validation\n") | ||
| cat("==========================\n") | ||
|
|
||
| # Try to create EventTable with invalid data | ||
| tryCatch({ | ||
| invalid_data <- tibble::tibble( | ||
| H1 = c(1, 2, -1), # Invalid: negative hypothesis index | ||
| H2 = c(1, 2, 3), | ||
| Analysis = c(1, 1, 1), | ||
| Event = c(100, 200, 150) | ||
| ) | ||
|
|
||
| invalid_table <- EventTable(data = invalid_data) | ||
| }, error = function(e) { | ||
| cat("Validation caught error:", e$message, "\n") | ||
| }) | ||
|
|
||
| # Example 3: Subsetting capabilities | ||
| cat("\nExample 3: Subsetting\n") | ||
| cat("=====================\n") | ||
|
|
||
| # Get only first analysis | ||
| analysis_1 <- subset_event_table(event_table, analysis = 1) | ||
| cat("Analysis 1 events:\n") | ||
| print(analysis_1@data) | ||
|
|
||
| # Get only H1-H2 hypothesis pairs | ||
| h1_h2_events <- subset_event_table(event_table, hypotheses = c(1, 2)) | ||
| cat("\nH1-H2 hypothesis events:\n") | ||
| print(h1_h2_events@data) | ||
|
|
||
| # Example 4: Summary information | ||
| cat("\nExample 4: Summary\n") | ||
| cat("==================\n") | ||
| summary(event_table) |
There was a problem hiding this comment.
This code fails when I run it locally:
summary(event_table)
## Error in check_subsettable(x, allow_env = TRUE) :
## S7 objects are not subsettable.| print(event_table) | ||
|
|
||
| # Get summary | ||
| summary(event_table) |
There was a problem hiding this comment.
This code fails when I run it locally:
summary(event_table)
## Error in check_subsettable(x, allow_env = TRUE) :
## S7 objects are not subsettable.There was a problem hiding this comment.
I added inst/aiprompts/ to .Rbuildignore in #54
| export(gen_corr) | ||
| export(generate_bounds) | ||
| export(generate_corr) | ||
| export(generate_corr_s7) |
There was a problem hiding this comment.
Note that this PR did not replace the existing generate_corr() with an S7 version (#46). Instead, it created an additional function generate_corr_s7().
Summary
This PR adds a new vignette demonstrating the WPGSD methodology for a Dunnett-type dose-finding trial and bumps the package version to 0.3.0.
New Vignette: Dunnett-type dose-finding with group sequential design
Demonstrates the WPGSD approach for a trial with 4 experimental dose groups vs. a common control with:
Key results
Other changes