Skip to content

Commit 3d30926

Browse files
committed
one row of model choices
1 parent ea6ec0d commit 3d30926

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

inst/add-in/gadget.R

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ parsnip_spec_add_in <- function() {
8282
)
8383
),
8484
fillRow(
85-
miniContentPanel(uiOutput("model_choices_left")),
86-
miniContentPanel(uiOutput("model_choices_right"))
85+
miniContentPanel(uiOutput("model_choices"))
8786
)
8887
)
8988
),
@@ -107,37 +106,23 @@ parsnip_spec_add_in <- function() {
107106
models
108107
}) # get_models
109108

110-
output$model_choices_left <- renderUI({
109+
output$model_choices <- renderUI({
111110

112111
model_list <- get_models()
112+
if (nrow(model_list) > 0) {
113113

114114
choices <- paste0(model_list$model, " (", model_list$engine, ")")
115115
choices <- unique(choices)
116-
# ind <- ceiling(length(choices)/2)
117-
# choices <- choices[1:ind]
118-
119-
checkboxGroupInput(
120-
inputId = "model_name_left",
121-
label = "",
122-
choices = choices
123-
)
124-
}) # model_choices_right
125-
126-
output$model_choices_right <- renderUI({
127-
128-
model_list <- get_models()
129-
130-
choices <- paste0(model_list$model, " (", model_list$engine, ")")
131-
choices <- unique(choices)
132-
ind <- ceiling(length(choices)/2) + 1
133-
choices <- choices[ind:length(choices)]
116+
} else {
117+
choices <- NULL
118+
}
134119

135120
checkboxGroupInput(
136-
inputId = "model_name_right",
121+
inputId = "model_name",
137122
label = "",
138123
choices = choices
139124
)
140-
}) # model_choices_right
125+
}) # model_choices
141126

142127
create_code <- reactive({
143128

0 commit comments

Comments
 (0)