I am trying to define a formula for multinomial logistic regression , it should take the input from drop down list upto maximum 6 Independent variables. ( SelectInput , Multiple = TRUE) in R Shiny. Not able to figure out how to resolve this ..
Here are sample code... Formula
Multiformula <- reactive ({
as.formula(paste(input$outcome,'~'input$predictor)
})
Model
MultiModel <- reactive({
multinom(Multiformula(), data = filtered())
})
Above code works for single variable, however for more than one independent variables the approach may be different. I tried the below but no luck
indvar6 <- reactive({
filter(forest_data_model[,input$predictor])
})
Redefined the formula... but it didn't work
Multiformula <- reactive ({as.formula(paste(input$outcome,'~'indvar6())})
Any guidance will be highly appreciated...thanks