R/crosslag_utils.R
changed.
Newly tracked file
R/formula_utils.R
changed.
Other files ignored by Codecov
NAMESPACE
has changed.
11 | 11 | vars <- |
|
12 | 12 | names(sapply(all.vars(formula), |
|
13 | 13 | function(x) is.numeric(data[[x]])) %just% FALSE) |
|
14 | - | vars <- vars %not% grouping_vars |
|
15 | 14 | # Expand these factors into 0/1 variables in the data |
|
16 | 15 | data <- expand_factors(vars, data) |
|
17 | 16 | # Now create a formula that does the same |
1 | + | #' @importFrom stats drop.terms reformulate |
|
1 | 2 | # Accessor function for Formula objects that have multiple parts |
|
2 | 3 | get_rhs <- function(x, which = 1, to.formula = FALSE) { |
|
3 | 4 | # Coercing to formula can be useful, otherwise it's a call object |
162 | 163 | ranefs <- if (is.list(ranefs)) sapply(ranefs, to_char) else to_char(ranefs) |
|
163 | 164 | ranefs <- stringr::str_replace_all(ranefs, "~", "") |
|
164 | 165 | } |
|
165 | - | if (length(attr(x, "rhs")) >= 3) { |
|
166 | - | # Remove ranefs from formula for now |
|
167 | - | attr(x, "rhs")[[3]] <- lme4::nobars(attr(x, "rhs")[[3]]) |
|
168 | - | } |
|
169 | 166 | ||
170 | 167 | for (i in seq_along(attr(x, "rhs"))) { |
|
171 | 168 | if (to_char(get_rhs(x, i, TRUE)) != "~ 1") { |
Files | Coverage |
---|---|
R | 74.03% |
Project Totals (9 files) | 74.03% |
1 |
comment: false |