Skip to content

Commit

Permalink
minor speed improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Sep 17, 2023
1 parent d74d94e commit de58753
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion R/comparisons.R
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ comparisons <- function(model,
se <- do.call("get_se_delta", args)
J <- attr(se, "jacobian")
attr(se, "jacobian") <- NULL
mfx$std.error <- as.numeric(se)
data.table::setDT(mfx)
mfx[, "std.error" := drop(se)]
draws <- NULL

# no standard error
Expand Down
2 changes: 1 addition & 1 deletion R/get_modeldata.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ get_modeldata <- function(model, additional_variables = FALSE, modeldata = NULL,
out <- evalup(attr(model, "call")$data)
}

out <- as.data.frame(out)
data.table::setDF(out)
out <- set_variable_class(out, model = model)
return(out)
}
Expand Down
4 changes: 2 additions & 2 deletions R/marginal_means.R
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ marginal_means <- function(model,
modeldata = modeldata)
args <- c(args, list(...))
args[["equivalence"]] <- NULL
mm <- do.call(get_marginalmeans, args)
out <- do.call(get_marginalmeans, args)

# we want consistent output, regardless of whether `data.table` is installed/used or not
out <- as.data.frame(mm)
data.table::setDF(out)

# standard errors via delta method
if (!vcov_false) {
Expand Down

0 comments on commit de58753

Please sign in to comment.