...HI,
i am anjana trying to create a shiny application for the random forest algorithm by taking the users input csv, that part is shown in the above figure
now i have a problem with displaying the column names in the feature variables and target variables. i just given all the variable names to the both checkbox group and select input group.
i have a problem here when i select the feature variable , from the checkbox group it should automatically remove from the target variables(select input box). can any one help me with best lines.
# Define server logic required to draw a histogram
server <- function(input, output) {
# Read file ----
df <- reactive({
req(input$uploaded_file)
read.csv(input$uploaded_file$datapath,
header = input$header,
sep = input$sep)
})
# Dynamically generate UI input when data is uploaded ----
output$checkbox <- renderUI({
checkboxGroupInput(inputId = "select_var",
label = "Select Feature variables",
choices = names(df()),
selected = names(df_sel_tar()))
})
output$selectbox<-renderUI({
selectInput(inputId = "select_var_tar",
label = "Select Target Variable",
choices = names(df()))
})
df_drop<-reactive({
req(input$select_var_tar)
drop(input$select_var_tar)
df_drop<-df() %>% df[,!names(df() % in % drop)]
})
# Select columns to print ----
df_sel <- reactive({
req(input$select_var)
df_sel <- df() %>% select(input$select_var)
})
df_sel_tar <- reactive({
req(input$select_var_tar)
df_sel_tar <- df() %>% select(input$select_var_tar)
})
##############
here is the code in this df_drop() we should write the code to drop the selected target variable from the select box input. once it gets selected from the sleeted box it should not appear in the checkbox group.