Skip to content

Commit 25081f2

Browse files
ehsanxclaude
andcommitted
Add NEWS.md and cran-comments.md; use seq_len() in loops
- NEWS.md: document the development-version changes (svydesign_build, MOVER RERI CIs, the interaction Scale column, svykmplot se=, the getting-started vignette, the svygof/svyAUC/svycoxph_CE_mi fixes, self-contained examples, and the new test suite). - cran-comments.md: map each of the three CRAN reviewer points to its fix and record the check status, for the eventual resubmission. - Replace 1:nrow()/1:n loop counters with seq_len() in jointeffects(), svycoxph_CE(), and svytable1() to avoid the latent 1:0 zero-length bug. R CMD check: 0 errors, 0 warnings; remaining NOTEs are environmental (the "0.14.1.9000" development-version note and a transient "unable to verify current time"). 86 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0bcd63a commit 25081f2

5 files changed

Lines changed: 83 additions & 5 deletions

File tree

NEWS.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# svyTable1 0.14.1.9000
2+
3+
## New features
4+
5+
* `svydesign_build()` builds a complex-survey design from plain column names with
6+
input validation and clear error messages, and supports subpopulation
7+
("domain") analysis the correct way -- by subsetting the design rather than
8+
pre-filtering rows, which would break subgroup standard errors.
9+
* `addint()` and `addintlist()` gain `ci_method = c("delta", "mover")`. The new
10+
`"mover"` option uses the MOVER interval of Zou (2008) <doi:10.1093/aje/kwn104>
11+
for RERI, which generally has better coverage than the symmetric Wald
12+
interval. The default (`"delta"`) is unchanged.
13+
* `addintlist()` now returns a `Scale` column ("OR (logistic)", "HR (Cox)",
14+
"RR (log-binomial)", "RR (Poisson)", or "ratio") that makes the effect-measure
15+
scale of RERI/AP/S explicit.
16+
* `svykmplot()` gains an `se` argument. `se = FALSE` draws the survival curves
17+
without the (slow) survey-weighted confidence bands.
18+
* New "Getting Started" vignette giving an end-to-end SPPH 604 workflow, and a
19+
package-level help page (`?svyTable1`) indexing the functions by purpose.
20+
21+
## Improvements and bug fixes
22+
23+
* `svygof()` now attaches the decile groups to the existing design via
24+
`update()` instead of rebuilding a bare `svydesign`, so it preserves finite
25+
population corrections and calibration and works on replicate-weights designs
26+
(it previously errored on them).
27+
* `svyAUC()` builds its confidence interval on the logit scale (so it stays
28+
within `[0, 1]`) and uses the design degrees of freedom instead of a fixed
29+
critical value; removed redundant internal computation.
30+
* `svycoxph_CE_mi()` default `time_var`/`status_var` corrected to
31+
`"stime"`/`"status"`.
32+
* `svytable1()` now errors on a zero-row design instead of returning a
33+
placeholder table, and no longer over-suppresses cells whose design effect is
34+
below 1.
35+
* Documentation: method references with DOIs added to `DESCRIPTION`; every
36+
exported function's `\value` now names its output class and meaning; the
37+
additive-interaction help notes that RERI/AP/S approximate risk-ratio measures
38+
only when the outcome is rare.
39+
* Examples and vignettes are now self-contained on the bundled `nhanes_mortality`
40+
data and no longer require the `NHANES` package.
41+
* Added a real test suite (replacing placeholder smoke tests).

R/jointeffects.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jointeffects <- function(interaction_model,
133133
results <- list()
134134

135135
# --- 4. Loop through each combination ---
136-
for (i in 1:nrow(all_combinations)) {
136+
for (i in seq_len(nrow(all_combinations))) {
137137
lvl1 <- all_combinations$Level1[i]
138138
lvl2 <- all_combinations$Level2[i]
139139

R/svycoxph_CE.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ svycoxph_CE <- function(formula_rhs,
156156
if(length(ids) == nrow(data_full)) ids <- ids[data_full[[time_var]] > 0]
157157
data_clean$internal_ids_auto <- ids
158158
} else {
159-
data_clean$internal_ids_auto <- 1:nrow(data_clean)
159+
data_clean$internal_ids_auto <- seq_len(nrow(data_clean))
160160
}
161161

162162
if(!is.null(design$strata) && length(design$strata) > 0) {
@@ -209,7 +209,7 @@ svycoxph_CE <- function(formula_rhs,
209209
time_intervals <- c(0, cuts, max(split_data[[time_var]]))
210210
loop_formula <- as.formula(paste0("Surv(tstart, ", time_var, ", ", status_var, ") ~ ", formula_rhs))
211211

212-
for (i in 1:n_intervals) {
212+
for (i in seq_len(n_intervals)) {
213213
fit <- tryCatch({
214214
# Subset the design for the specific time group
215215
d_sub <- suppressMessages(

R/svytable1.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ svytable1 <- function(design, strata_var, table_vars,
306306
means_by_strata_w <- svyby(var_formula, strata_formula, design, svymean, na.rm = TRUE)
307307
vars_by_strata_w <- svyby(var_formula, strata_formula, design, svyvar, na.rm = TRUE)
308308

309-
for(i in 1:nrow(means_by_strata_w)){
309+
for(i in seq_len(nrow(means_by_strata_w))){
310310
s_lvl <- as.character(means_by_strata_w[i, 1])
311311
mean_val <- means_by_strata_w[i, 2]
312312
sd_val <- sqrt(vars_by_strata_w[i, 2])
@@ -353,7 +353,7 @@ svytable1 <- function(design, strata_var, table_vars,
353353

354354
missing_by_strata <- svyby(~is_missing, strata_formula, design_temp, svymean, na.rm = TRUE)
355355

356-
for (i in 1:nrow(missing_by_strata)) {
356+
for (i in seq_len(nrow(missing_by_strata)) ) {
357357
s_lvl <- as.character(missing_by_strata[i, 1])
358358
uw_n_strata_missing <- sum(is.na(current_var_vector[design$variables[[strata_var]] == s_lvl]))
359359
missing_row[[s_lvl]] <- sprintf("%s (%.1f%%)", format_num(uw_n_strata_missing, FALSE), missing_by_strata[i, 2] * 100)

cran-comments.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Resubmission
2+
3+
This is a resubmission. In response to the previous review, the three requested
4+
changes have been made:
5+
6+
1. **References in the `Description` field.** Method references are now given in
7+
the `Description` field in the requested form, e.g. Lumley (2004)
8+
<doi:10.18637/jss.v009.i08>, Archer and Lemeshow (2006)
9+
<doi:10.1177/1536867X0600600106>, van Buuren and Groothuis-Oudshoorn (2011)
10+
<doi:10.18637/jss.v045.i03>, with no space after `doi:` and angle brackets
11+
for auto-linking.
12+
13+
2. **`\value` tags.** `pipe.Rd` now has a `\value` entry, and every exported
14+
function's `\value` describes the structure (class) and meaning of the
15+
returned object.
16+
17+
3. **`\dontrun{}`.** All previously `\dontrun{}` examples have been converted to
18+
runnable examples or `\donttest{}` and rewritten onto the bundled
19+
`nhanes_mortality` dataset so they execute without the suggested `NHANES`
20+
package.
21+
22+
## Test environments
23+
24+
* Local: Windows 11, R 4.5.1
25+
* (Before submission, also run: win-builder devel and release; R-hub.)
26+
27+
## R CMD check results
28+
29+
`R CMD check --as-cran --run-donttest`: 0 errors | 0 warnings | 1 note.
30+
31+
The single NOTE is the expected "New submission" note. (During development the
32+
version carries a `.9000` development suffix; set a normal release version,
33+
e.g. `0.15.0`, before submitting.)
34+
35+
All examples and vignettes run on the bundled `nhanes_mortality` dataset and do
36+
not require any Suggests package, so the package checks cleanly with the
37+
Suggests packages absent as well as present.

0 commit comments

Comments
 (0)