two column value in one input

Is it possible to add two column values ​​to a select input?

Hello, I dont know if you refer to something like that:

selectInput("IP","Input",choices = c("A","B","C")

that is to say; combining elements.

If you only want to add values to a previous select input,
then in your selectize input you can add values more easily:

Resources:
https://shiny.rstudio.com/reference/shiny/1.6.0/selectInput.html
https://shiny.rstudio.com/articles/selectize.html

Hope this helps.

by column value, do you mean a value in the column BPName. ?
I think your question is confusing me because shinywidgets::selectizeGroupUI allows multiple values for all your selectors by default.

See the first example from the documentation

library(shiny)
library(shinyWidgets)

data("mpg", package = "ggplot2")

ui <- fluidPage(
  fluidRow(
    column(
      width = 10, offset = 1,
      tags$h3("Filter data with selectize group"),
      panel(
        selectizeGroupUI(
          id = "my-filters",
          params = list(
            manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
            model = list(inputId = "model", title = "Model:"),
            trans = list(inputId = "trans", title = "Trans:"),
            class = list(inputId = "class", title = "Class:")
          )
        ), status = "primary"
      ),
      DT::dataTableOutput(outputId = "table")
    )
  )
)
server <- function(input, output, session) {
  res_mod <- callModule(
    module = selectizeGroupServer,
    id = "my-filters",
    data = mpg,
    vars = c("manufacturer", "model", "trans", "class")
  )
  output$table <- DT::renderDataTable(res_mod())
}

shinyApp(ui, server)


This example is the most related that I can conceive.

If this do not work for you, you can do feature engineering with the variable. (For example, many categorical variables, can be transformed into a Binary Variable (0,1) or (-1,1).
Since is only one variable its not so complicated.

Sincerely, I hope any of these help you. I dont know other solution :sweat_smile:
Best of wishes.

I'm sorry, but I don't follow your explanation.
How does the example that you are using as a base differ from your data/ needs.
Perhaps you can make your own example code and we can look at that.

I'm wondering if your issue is that the selectors you want don't align with your actual data .

I am not able to solve my problem using this. can you help me more?

only I want to add two column values in input id "BiologicalprocessName", "BiologicalprocessName1"

BPName = list(inputId = "BiologicalprocessName","BiologicalprocessName1", title = "Select The Biological Process[Top 5]")

If you don't engage with what I write to you it becomes impossible to help you

I have tried to use this but can't solve it.

Please take the time to learn what a reprex is, and make one.

I saw from a previous post that you might have a column which contains comma separated paired values, when you in fact want separate columns for the values. You can use this approach.

library(tidyverse)

(startdf <- structure(list(id = 1:10, somevar = c(
  "a,K", "b,L", "c,M", "d,N",
  "e,O", "f,P", "g,Q", "h,R", "i,S", "j,T"
)), class = "data.frame", row.names = c(
  NA,
  -10L
)))

(fixed_df <- separate(startdf,
                     col="somevar",
                     into=paste0("somevar",1:2)))

library(shiny)
library(shinyWidgets)
library(DT)

ui <- fluidPage(
  fluidRow(

    column(
      width = 10, offset = 1,
      DT::dataTableOutput(outputId = "pretable"),
      tags$h3("Filter data with selectize group"),
      panel(
        selectizeGroupUI(
          id = "my-filters",
          params = list(
            id = list(inputId = "id", title = "id:"),
            somevar1 = list(inputId = "somevar1", title = "somevar1:"),
            somevar2 = list(inputId = "somevar2", title = "somevar2:")
          )
        ), status = "primary"
      ),
      DT::dataTableOutput(outputId = "table")
    )
  )
)
server <- function(input, output, session) {
  res_mod <- callModule(
    module = selectizeGroupServer,
    id = "my-filters",
    data = fixed_df,
    vars = c("id", "somevar1", "somevar2")
  )
  output$pretable <- DT::renderDataTable(startdf)
  output$table <- DT::renderDataTable(res_mod())
}

shinyApp(ui, server)

I have compiled the reprex but I don't know how to use it. can you share any examples according to my problem?

two column value in one input - #12 by nirgrahamuk ?

I am talking about the reprex.

Beyond what I've said, I have no idea how to help you. I can't understand your responses. Sorry.

please provide a reprex for further assistance.

what do you want to say?

With all due respect, the community forum is intended to help people to resolve exercise problems, not to make your homework You also have to put an effort. I am astonished of the patience that @nigrahamuk have to help you and you are acting very disrespectful and ungrateful.
So, we were trying to help you, in general, the community members are not your employees. So, please limit your ego and follow the civilized guidelines of the comunities. Please.

I see, but a week trying to help has passed. Thinking logically, there are only two solutions:
1.No one understood the problem.(including the people who read your post but did not answer.)
In that case, I recommend you to better reformulate your question, in another post.
2. The problem that you wrote has no practical solution. (Or no one has written about it, if no one know it , then I think you shouldn't worry too much about it use.)
I feel so much, sincerely I hope you can improve your R skills. Perhaps only a small change is needed to reformulate the problem.

Then it was the option one, the question needed to be reformulated.
Happy to see that you resolved it well.
Thanks for posting the answers, It will be useful to many people who may have the same problem.
Best wishes and happy coding. :smiley:

1 Like