Skip to content
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

Fixing logisticCoefs double dot bug #221

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# simstudy (development version)

## Minor fix

* Function `logisticCoefs` now correctly handles double dot notation.

# simstudy 0.7.1

## Breaking Changes
Expand Down
12 changes: 12 additions & 0 deletions R/utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,18 @@
if (!is.null(rd)) targetStat <- "rd"
if (!is.null(auc)) targetStat <- "auc"

# Get any double dot vars from calling environment into this environment

.formvars <- all.vars(parse(text = defCovar$formula))
.dotVars <- .formvars[startsWith(.formvars, "..")]
.vars <- gsub("^\\.{2}", "", .dotVars)

Check warning on line 1079 in R/utility.R

View check run for this annotation

Codecov / codecov/patch

R/utility.R#L1077-L1079

Added lines #L1077 - L1079 were not covered by tests

for (i in seq_along(.vars)) {
assign(.vars[i], get(.vars[i], envir = parent.frame()))

Check warning on line 1082 in R/utility.R

View check run for this annotation

Codecov / codecov/patch

R/utility.R#L1081-L1082

Added lines #L1081 - L1082 were not covered by tests
}

#

dd <- genData(sampleSize, defCovar)

if (targetStat == "prev") {
Expand Down
Loading