Skip to content

Commit 581a9ab

Browse files
committed
attempt to revert back
1 parent cfa0fa8 commit 581a9ab

File tree

4 files changed

+6
-71
lines changed

4 files changed

+6
-71
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export(parse_multiplemember)
1717
export(parse_power)
1818
export(parse_randomeffect)
1919
export(parse_varyarguments)
20-
export(parse_varyarguments_mf)
2120
export(parse_varyarguments_w)
2221
export(random_missing)
2322
export(rbimod)

R/parse_formula.r

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ parse_varyarguments_w <- function(sim_args, name) {
245245
names = name,
246246
exclude = FALSE),
247247
KEEP.OUT.ATTRS = FALSE)
248-
# conditions <- list_select(sim_args[['vary_arguments']],
249-
# names = name,
250-
# exclude = FALSE)
251248
if(any(sapply(conditions, is.list))) {
252249
loc <- sapply(conditions, is.list)
253250
simp_conditions <- conditions[loc != TRUE]
@@ -268,39 +265,6 @@ parse_varyarguments_w <- function(sim_args, name) {
268265
}
269266

270267
}
271-
#' Parse within varying arguments
272-
#'
273-
#' @param sim_args A named list with special model formula syntax. See details and examples
274-
#' for more information. The named list may contain the following:
275-
#' \itemize{
276-
#' \item fixed: This is the fixed portion of the model (i.e. covariates)
277-
#' \item random: This is the random portion of the model (i.e. random effects)
278-
#' \item error: This is the error (i.e. residual term).
279-
#' }
280-
#' @param name The name of the within simulation condition. This is primarily
281-
#' an internal function.
282-
#'
283-
#' @export
284-
parse_varyarguments_mf <- function(sim_args, name) {
285-
286-
conditions <- list_select(sim_args[['vary_arguments']],
287-
names = name,
288-
exclude = FALSE)
289-
if(any(sapply(conditions, is.list))) {
290-
loc <- sapply(conditions, is.list)
291-
list_conditions <- conditions[loc == TRUE]
292-
update_conditions <- lapply(seq_along(conditions), function(xx) c(sim_args,
293-
model_fit = list_conditions[xx]))
294-
for(xx in seq_along(update_conditions)) {
295-
names(update_conditions[[xx]]) <- gsub("\\..*", "", names(update_conditions[[xx]]))
296-
}
297-
} else {
298-
lapply(1:nrow(conditions), function(xx) c(sim_args,
299-
conditions[xx, , drop = FALSE]))
300-
}
301-
302-
}
303-
304268

305269
#' Parse correlation arguments
306270
#'

R/pow_sim.r

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,20 @@ replicate_simulation_vary <- function(sim_args, return_list = FALSE,
145145
within_conditions <- list_select(sim_args[['vary_arguments']],
146146
names = c('model_fit'),
147147
exclude = FALSE, simplify = FALSE)
148-
if(length(within_conditions) > 0 ) {
149-
within_conditions_name <- names(
150-
list_select(sim_args[['vary_arguments']],
151-
names = c('model_fit'),
152-
exclude = FALSE, simplify = TRUE)
153-
)
154-
}
155148
between_conditions <- list_select(sim_args[['vary_arguments']],
156149
names = c('model_fit', 'power'),
157150
exclude = TRUE, simplify = FALSE)
158151

159152
between_conditions_name <- data.frame(sapply(expand.grid(between_conditions, KEEP.OUT.ATTRS = FALSE),
160153
as.character))
154+
within_conditions_name <- data.frame(sapply(expand.grid(within_conditions, KEEP.OUT.ATTRS = FALSE),
155+
as.character))
161156

162157

163158
sim_arguments <- parse_varyarguments(sim_args)
164159

165-
if(length(within_conditions) > 0) {
166-
sim_arguments_w <- parse_varyarguments_mf(sim_args, name = c('model_fit'))
160+
if(length(within_conditions_name) > 0) {
161+
sim_arguments_w <- parse_varyarguments_w(sim_args, name = c('model_fit'))
167162

168163
if(any(unlist(lapply(seq_along(sim_arguments_w), function(xx)
169164
sim_arguments_w[[xx]][['model_fit']] |> names())) == 'name')) {
@@ -190,7 +185,7 @@ replicate_simulation_vary <- function(sim_args, return_list = FALSE,
190185
}, future.seed = future.seed)
191186
}, future.seed = future.seed)
192187
}
193-
if(length(within_conditions) == 0) {
188+
if(length(within_conditions_name) == 0) {
194189

195190
power_out <- future.apply::future_lapply(seq_along(sim_arguments), function(xx) {
196191
future.apply::future_replicate(sim_arguments[[xx]][['replications']],
@@ -215,7 +210,7 @@ replicate_simulation_vary <- function(sim_args, return_list = FALSE,
215210
rep(1:sim_args[['replications']],
216211
each = num_rows[xx]/sim_args[['replications']]))
217212

218-
if(length(within_conditions) > 0) {
213+
if(length(within_conditions_name) > 0) {
219214
num_terms <- lapply(seq_along(power_out), function(xx)
220215
lapply(seq_along(power_out[[xx]]), function(yy)
221216
lapply(power_out[[xx]][[yy]], nrow))

man/parse_varyarguments_mf.Rd

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)