The error in sfcr_set_index is caused when if(){}else{} condition are used in the equations of the model.
This is the error message:
> index <- sfcr_set_index(model_eqs)
Error in `dplyr::mutate()`:
ℹ In argument: `id = 1:length(eqs)`.
Caused by error:
! `id` must be size 190 or 1, not 146.
sfcr_set_index <- function(eqs) {
eqs = model_eqs
abortifnot(inherits(eqs, "sfcr_set"), "Please supply a list of equations created with `sfcr_set()`.")
purrr::map_df(eqs, ~ tibble::enframe(name = "id", deparse(.x, width.cutoff = 500))) %>%
dplyr::mutate(id = 1:length(eqs)) %>%
tidyr::separate(.data$value, into = c("lhs", "rhs"), " ~ ")
}
The error happens in this part of the code purrr::map_df(eqs, ~ tibble::enframe(name = "id", deparse(.x, width.cutoff = 500))) as the if(){}else{} condition is split up in to several rows. This can be seen in the screenshot I attached.
The error in
sfcr_set_index
is caused whenif(){}else{}
condition are used in the equations of the model.This is the error message:
The error happens in this part of the code
purrr::map_df(eqs, ~ tibble::enframe(name = "id", deparse(.x, width.cutoff = 500)))
as theif(){}else{}
condition is split up in to several rows. This can be seen in the screenshot I attached.