Merck / Merck/gsDesign2

`to_integer()` removes column `spending_time` from the bound table

Open Beginner friendly
#675 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
34
Forks
11
Avg merge
2d 14h
Merged PRs (30d)
7

Description

While reviewing #673, I noticed that to_integer() removes the column spending_time from the bound table. Is this a bug? Below is a reprex using the latest commit on main, https://github.com/Merck/gsDesign2/commit/732921e6db24b1fe84b0681d5c4753c679bb91b9:

library("gsDesign2")

x <- gs_design_ahr()
colnames(x$bound)
## [1] "analysis"      "bound"         "probability"   "probability0"  "z"             "~hr at bound" 
## [7] "nominal p"     "spending_time"
xint <- to_integer(x)
colnames(xint$bound)
## [1] "analysis"     "bound"        "probability"  "probability0" "z"            "~hr at bound"
## [7] "nominal p" 

summary(x, display_spending_time = TRUE)
## # A tibble: 1 × 8
## # Groups:   Analysis [1]
##   Analysis Bound     Z `Spending time` `~HR at bound` `Nominal p` `Alternate hypothesis` `Null hypothesis`
##   <chr>    <chr> <dbl>           <dbl>          <dbl>       <dbl>                  <dbl>             <dbl>
## 1 Analysi… Effi…  1.96               1          0.795       0.025                    0.9             0.025

summary(xint, display_spending_time = TRUE)
## Error in `select()` at gsDesign2/R/summary.R:349:3:
## ℹ In argument: `all_of(col_vars)`.
## Caused by error in `all_of()`:
## ! Can't subset elements that don't exist.
## ✖ Element `Spending time` doesn't exist.
## Run `rlang::last_trace()` to see where the error occurred.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided R reprex, then inspect to_integer() and the select() call at gsDesign2/R/summary.R:349. Trace how the bound table's spending_time column is transformed; done means to_integer(x) retains it and summary(xint, display_spending_time = TRUE) completes without the missing-column error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.