From 90fa9deafadd1e1d8ca7d2063ab2079d23f86333 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 27 Nov 2023 18:58:30 +0100 Subject: [PATCH] lintr --- R/format_parameters.R | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/R/format_parameters.R b/R/format_parameters.R index 101c6227a..e90c8ef90 100644 --- a/R/format_parameters.R +++ b/R/format_parameters.R @@ -139,19 +139,8 @@ format_parameters.parameters_model <- function(model, ...) { for (i in seq_len(nrow(types))) { name <- types$Parameter[i] - # No interaction - if (!types$Type[i] %in% c("interaction", "nested", "simple")) { - type <- types[i, ] - names[i] <- .format_parameter( - name, - variable = type$Variable, - type = type$Type, - level = type$Level, - brackets = brackets - ) - + if (types$Type[i] %in% c("interaction", "nested", "simple")) { # Interaction or nesting - } else { components <- unlist(strsplit(name, ":", fixed = TRUE), use.names = FALSE) is_nested <- types$Type[i] == "nested" is_simple <- types$Type[i] == "simple" @@ -193,6 +182,16 @@ format_parameters.parameters_model <- function(model, ...) { is_simple = is_simple, ... ) + } else { + # No interaction + type <- types[i, ] + names[i] <- .format_parameter( + name, + variable = type$Variable, + type = type$Type, + level = type$Level, + brackets = brackets + ) } } @@ -345,9 +344,9 @@ format_parameters.parameters_model <- function(model, ...) { #' @keywords internal .format_ordered <- function(degree, brackets = c("[", "]")) { switch(degree, - `.L` = paste0(brackets[1], "linear", brackets[2]), - `.Q` = paste0(brackets[1], "quadratic", brackets[2]), - `.C` = paste0(brackets[1], "cubic", brackets[2]), + .L = paste0(brackets[1], "linear", brackets[2]), + .Q = paste0(brackets[1], "quadratic", brackets[2]), + .C = paste0(brackets[1], "cubic", brackets[2]), paste0( brackets[1], parameters::format_order(as.numeric(gsub("^", "", degree, fixed = TRUE)), textual = FALSE),