Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 27, 2023
1 parent 73a1b96 commit 90fa9de
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions R/format_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
)
}
}

Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 90fa9de

Please sign in to comment.