Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Shiny conditional input panel with vector

I am looking to create a conditional panel in shiny that becomes active if the input that user selects from a list (i.e. selectInput function) belongs to another vector.

I am aware that the condition in the conditional panel is a javascript element, however I cannot make it work.

Can someone help?

Here is the UI part of the code under examination:

legs1 <- c("HOUSE","VILLA","ATTICO")

selectInput("strategy", "Strategy:", choices = df[,6]),

conditionalPanel(
           
          condition = 'input.strategy && input.strategy.indexOf("legs1") > -1',
                              
          textInput("Leg1", "Leg1",value = ""),
          textInput("Leg2","Leg2", value =""),
          
          ),

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you don't have to access the vector from within the condition it should work by using

condition = "input.strategy && ['HOUSE', 'VILLA', 'ATTICO'].indexOf(input.strategy) > -1"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!