Skip to content

Commit

Permalink
Modifying .evalWith and adding broom.helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Goldfeld committed Jul 24, 2024
1 parent 89ce276 commit f2cf8c8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Suggests:
survival,
testthat,
gtsummary,
broom.helpers,
survminer,
katex,
dirmult,
Expand Down
4 changes: 2 additions & 2 deletions R/generate_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@
" two probabilities."
))
}

parsedProbs <-
.evalWith(formulas, .parseDotVars(formulas, envir), dtSim, n, envir)

if (link == "logit") {
parsedProbs <- exp(parsedProbs)
parsedProbs <- parsedProbs / (1 + rowSums(parsedProbs))
Expand Down
20 changes: 19 additions & 1 deletion R/internal_utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,25 @@
}
}

list2env(as.list(envir), envir = environment()) # added 20240718
### Get functions from calling environment - added 20240724

if (length(ls(envir)) != 0) {.

all_objects <- ls(envir)

function_objects <- all_objects[
sapply(
all_objects,
function(obj) {
is.function(get(obj, envir = envir))
})
]

functions_list <- mget(function_objects, envir = envir)
list2env(functions_list, envir = environment())
}

####

parsedValues <- sapply(formula, evalFormula)

Expand Down

0 comments on commit f2cf8c8

Please sign in to comment.