Skip to content

Commit 4c4ffb2

Browse files
committed
Fix R CMD check documentation errors and warnings
- 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
1 parent dc64376 commit 4c4ffb2

11 files changed

Lines changed: 96 additions & 228 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ VignetteBuilder:
4949
knitr
5050
Config/testthat/edition: 3
5151
Roxygen: list(markdown = TRUE)
52-
RoxygenNote: 7.3.2
52+
RoxygenNote: 7.3.3

R/compute_correlations.R

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,6 @@
1919
#' Check event data for correlation computation
2020
#'
2121
#' @description
22-
#' Validates input event data for computing correlations between test statistics.
23-
#' Performs comprehensive checks on data structure, values, and completeness.
24-
#'
25-
#' @param event A data frame with columns H1, H2, Analysis, and Event containing
26-
#' event count data for correlation computation
27-
#'
28-
#' @return Invisibly returns TRUE if all checks pass, otherwise throws an error
29-
#'
30-
#' @examples
31-
#' library(tibble)
32-
#'
33-
#' # Valid event data
34-
#' event_data <- tibble(
35-
#' H1 = c(1, 2, 1, 1, 2, 1),
36-
#' H2 = c(1, 2, 2, 1, 2, 2),
37-
#' Analysis = c(1, 1, 1, 2, 2, 2),
38-
#' Event = c(155, 160, 85, 305, 320, 170)
39-
#' )
40-
#' Check Event Data for Correlation Computation
41-
#'
42-
#' @description
4322
#' This function validates event data before correlation computation.
4423
#' It ensures the data has the correct structure and satisfies all mathematical
4524
#' requirements for computing correlations.
@@ -59,6 +38,15 @@
5938
#' - Unique combinations of H1, H2, Analysis
6039
#'
6140
#' @examples
41+
#' library(tibble)
42+
#'
43+
#' # Valid event data
44+
#' event_data <- tibble(
45+
#' H1 = c(1, 2, 1, 1, 2, 1),
46+
#' H2 = c(1, 2, 2, 1, 2, 2),
47+
#' Analysis = c(1, 1, 1, 2, 2, 2),
48+
#' Event = c(155, 160, 85, 305, 320, 170)
49+
#' )
6250
#' check_event_data(event_data)
6351
#'
6452
#' @export

R/generate_event_ol.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' This function generates a table of events for specified populations based on the provided hypotheses.
22
#'
3-
#' @param event` dataframe should have the following structure:
3+
#' @param event dataframe should have the following structure:
44
#' - `Population`: A character vector indicating the population groups (e.g., "Population 1", "Population 2", "Population 1 Intersection 2", and "Overall population").
55
#' - `IA`: Numeric vector indicating the number of events observed in each group during interim analysis.
66
#' - `FA`: Numeric vector indicating the number of events observed in each group during final analysis.

R/generate_event_table_.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' This function creates a table summarizing event counts based on specified hypotheses and user input data.
22
#' It can handle two types of analysis: one comparing experimental groups to a common control and another analyzing the overlap of populations.
33
#'
4-
#' @param event` dataframe should have the following structure:
4+
#' @param event dataframe should have the following structure:
55
#' - `Population`: A character vector indicating the population groups. For example, "Population 1", "Population 2", "Overall population" in overlap population situation; or experimental arms and control in common control situation.
66
#' - `IA`: Numeric vector indicating the number of events observed in each group during interim analysis.
77
#' - `FA`: Numeric vector indicating the number of events observed in each group during final analysis.

R/s7_classes.R

Lines changed: 7 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# data structures used in weighted parametric group sequential designs.
2424

2525
#' @importFrom S7 new_class new_object class_data.frame class_integer class_character new_S3_class S7_inherits S7_object method
26+
NULL
2627

2728
#' EventTable S7 Class
2829
#'
@@ -56,10 +57,10 @@
5657
#'
5758
#' # Create valid event data
5859
#' event_data <- tibble(
59-
#' H1 = c(1L, 1L, 2L, 2L),
60-
#' H2 = c(1L, 2L, 2L, 2L),
61-
#' Analysis = c(1L, 1L, 1L, 2L),
62-
#' Event = c(155.5, 85.2, 160.7, 170.3)
60+
#' H1 = c(1L, 2L, 1L, 1L, 2L, 1L),
61+
#' H2 = c(1L, 2L, 2L, 1L, 2L, 2L),
62+
#' Analysis = c(1L, 1L, 1L, 2L, 2L, 2L),
63+
#' Event = c(155, 160, 85, 305, 320, 170)
6364
#' )
6465
#'
6566
#' # Create EventTable object
@@ -69,9 +70,7 @@
6970
#' print(event_table@n_hypotheses) # Number of hypotheses
7071
#' print(event_table@n_analyses) # Number of analyses
7172
#'
72-
#' # Use with existing wpgsd functions
73-
#' correlation_matrix <- generate_corr(event_table@data)
74-
#'
73+
#' @name EventTable
7574
#' @export
7675
# Define the EventTable S7 class
7776
EventTable <- S7::new_class(
@@ -200,43 +199,6 @@ as_event_table <- function(data) {
200199
EventTable(data = data)
201200
}
202201

203-
#' Core Event Data Validation Function
204-
#'
205-
#' @description
206-
#' Comprehensive validation function for event data used across the package.
207-
#' This is the single source of truth for event data validation logic.
208-
#'
209-
#' @param data A data.frame or tibble to validate
210-
#' @param validation_level Character string specifying validation level:
211-
#' - "basic": Check required columns, data types, and basic constraints
212-
#' - "strict": Include advanced mathematical requirements for correlation computation
213-
#' - "s7": Full validation for S7 EventTable objects
214-
#' @param return_errors Logical. If TRUE, return error messages instead of stopping.
215-
#' Used for S7 validators which expect error messages.
216-
#'
217-
#' @return If `return_errors = FALSE`: `TRUE` if validation passes (invisible),
218-
#' otherwise stops with descriptive error message.
219-
#' If `return_errors = TRUE`: `TRUE` if validation passes, otherwise
220-
#' first error message as character string.
221-
#'
222-
#' @details
223-
#' Validation checks performed:
224-
#'
225-
#' **Basic level:**
226-
#' - Required columns (H1, H2, Analysis, Event) are present
227-
#' - All columns are numeric
228-
#' - Hypothesis indices (H1, H2) are positive
229-
#' - Analysis numbers are positive
230-
#' - Event counts are non-negative
231-
#'
232-
#' **Strict level (includes basic plus):**
233-
#' - H1 <= H2 for all rows (correlation computation requirement)
234-
#' - Unique combinations of H1, H2, Analysis
235-
#' - Sequential hypothesis and analysis indices starting from 1
236-
#' - Diagonal entries exist for all off-diagonal entries
237-
#'
238-
239-
240202
#' Validate EventTable Data Format
241203
#'
242204
#' @description
@@ -279,53 +241,6 @@ validate_event_table_data <- function(data) {
279241
validate_event_data_core(data, validation_level = "basic")
280242
}
281243

282-
#' Create EventTable S7 Object
283-
#'
284-
#' @description
285-
#' Create a type-safe S7 EventTable object that represents event count data
286-
#' structure used in `generate_corr()` and `generate_event_table()`. This class
287-
#' provides validation and computed properties for hypothesis and analysis counts.
288-
#'
289-
#' @param data A tibble or data.frame containing the required columns:
290-
#' - `H1`: First hypothesis index (numeric, positive integers)
291-
#' - `H2`: Second hypothesis index (numeric, positive integers)
292-
#' - `Analysis`: Analysis number (numeric, positive integers)
293-
#' - `Event`: Event count (numeric, non-negative)
294-
#'
295-
#' @details
296-
#' The EventTable class automatically validates the input data and computes:
297-
#' - `n_hypotheses`: Maximum hypothesis index across H1 and H2 columns
298-
#' - `n_analyses`: Maximum analysis number
299-
#'
300-
#' The class ensures data integrity by validating that:
301-
#' - All required columns are present
302-
#' - H1, H2, Analysis, and Event are numeric
303-
#' - Hypothesis indices are positive integers
304-
#' - Analysis numbers are positive integers
305-
#' - Event counts are non-negative
306-
#'
307-
#' @return An EventTable S7 object with validated data and computed properties
308-
#'
309-
#' @examples
310-
#' library(tibble)
311-
#'
312-
#' # Create sample event data
313-
#' event_data <- tibble(
314-
#' H1 = c(1, 2, 1, 1, 2, 1),
315-
#' H2 = c(1, 2, 2, 1, 2, 2),
316-
#' Analysis = c(1, 1, 1, 2, 2, 2),
317-
#' Event = c(155, 160, 85, 305, 320, 170)
318-
#' )
319-
#'
320-
#' # Create EventTable object
321-
#' event_table <- EventTable(data = event_data)
322-
#'
323-
#' # Access properties
324-
#' print(event_table@n_hypotheses) # Number of hypotheses
325-
#' print(event_table@n_analyses) # Number of analyses
326-
#'
327-
#' # Use with existing wpgsd functions
328-
#' correlation_matrix <- generate_corr(event_table@data)
329244
# CorrelationMatrix S7 Class ====
330245

331246
#' CorrelationMatrix S7 Class
@@ -361,6 +276,7 @@ validate_event_table_data <- function(data) {
361276
#'
362277
#' print(corr_obj)
363278
#'
279+
#' @name CorrelationMatrix
364280
#' @export
365281
CorrelationMatrix <- S7::new_class("CorrelationMatrix",
366282
properties = list(

man/CorrelationMatrix.Rd

Lines changed: 1 addition & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/EventTable.Rd

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/check_event_data.Rd

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)