|
22 | 22 | if (isTRUE(info$joint_test)) { |
23 | 23 | table_footer <- NULL |
24 | 24 | } else { |
25 | | - table_footer <- paste0("\nVariable predicted: ", toString(insight::find_response(model))) |
| 25 | + table_footer <- paste0( |
| 26 | + "\nVariable predicted: ", |
| 27 | + toString(insight::find_response(model)) |
| 28 | + ) |
26 | 29 | } |
27 | 30 |
|
28 | 31 | # modulated predictors (focal terms) --------------------------------------- |
29 | 32 |
|
30 | 33 | if (!is.null(by) && !isTRUE(info$joint_test)) { |
31 | 34 | modulate_string <- switch(type, inequality = , contrasts = "contrasted", "modulated") |
32 | | - table_footer <- paste0(table_footer, "\nPredictors ", modulate_string, ": ", toString(by)) |
| 35 | + table_footer <- paste0( |
| 36 | + table_footer, |
| 37 | + "\nPredictors ", |
| 38 | + modulate_string, |
| 39 | + ": ", |
| 40 | + toString(by) |
| 41 | + ) |
33 | 42 | } |
34 | 43 |
|
35 | 44 | # predictors controlled (non-focal terms) ---------------------------------- |
|
49 | 58 | # over the list, because we may have different types of data |
50 | 59 | for (av in seq_along(adjusted_values)) { |
51 | 60 | if (is.numeric(adjusted_values[[av]])) { |
52 | | - adjusted_for[av] <- sprintf("%s (%.2g)", adjusted_for[av], adjusted_values[[av]]) |
| 61 | + adjusted_for[av] <- sprintf( |
| 62 | + "%s (%.2g)", |
| 63 | + adjusted_for[av], |
| 64 | + adjusted_values[[av]] |
| 65 | + ) |
53 | 66 | } else if (identical(type, "predictions")) { |
54 | 67 | adjusted_for[av] <- sprintf("%s (%s)", adjusted_for[av], adjusted_values[[av]]) |
55 | 68 | } |
|
87 | 100 |
|
88 | 101 | # tell user about scale of predictions / contrasts ------------------------- |
89 | 102 |
|
90 | | - result_type <- switch(type, inequality = "Differences", contrasts = "Contrasts", "Predictions") |
| 103 | + result_type <- switch( |
| 104 | + type, |
| 105 | + inequality = "Differences", |
| 106 | + contrasts = "Contrasts", |
| 107 | + "Predictions" |
| 108 | + ) |
91 | 109 |
|
92 | 110 | if (!is.null(predict) && isFALSE(model_info$is_linear)) { |
93 | 111 | # exceptions |
|
99 | 117 | `invlink(link)` = "response", |
100 | 118 | predict |
101 | 119 | ) |
| 120 | + ## TODO: simplification, we just mention it is transformed; we could check |
| 121 | + ## model info and then handle different cases, like odds ratios or IRRs etc. |
| 122 | + ## See `.guess_estimate_name()` |
| 123 | + if (!is.null(transform)) { |
| 124 | + predict <- "transformed" |
| 125 | + } |
102 | 126 | table_footer <- paste0( |
103 | 127 | table_footer, |
104 | 128 | "\n", |
|
141 | 165 | hypothesis_labels <- unlist( |
142 | 166 | lapply(parameter_names, function(i) { |
143 | 167 | rows <- as.numeric(sub(".", "", i)) |
144 | | - paste0(i, " = ", toString(paste0(info$focal_terms, " [", transposed_dg[, rows], "]"))) |
| 168 | + paste0( |
| 169 | + i, |
| 170 | + " = ", |
| 171 | + toString(paste0(info$focal_terms, " [", transposed_dg[, rows], "]")) |
| 172 | + ) |
145 | 173 | }), |
146 | 174 | use.names = FALSE |
147 | 175 | ) |
|
0 commit comments