how to create "gated" / skip logic surveys



Hey Guys,

I'm looking to create a survey in R Shiny that is gated - I need some way of implementing skip logic/conditional branching (yes I know there's Google forms for example that will do this for me, but I'm limited in what platforms are accessible to us).

Main Question: What is your favorite fruit?
a) apple
b) banana
c) kiwi
d) pineapple

F/u Questions:
Q2: The color is my favorite part of the (fruit name).
a) true
b) false

Q3: The taste is my favorite part of the (fruit name).
a) true
b) false

Several ideas I have about this (let me know if there's something I haven't thought of!):

  1. Have the Main question come up every time after the f/u questions are asked but ask about the next favorite (i.e. "what is your second favorite fruit? what is your third favorite fruit?)
    a. Not ideal because people may forget which fruits they've already answered questions for and may do the same fruit twice.
    b. If they did do the same fruit twice, would their answers just get written over or what it create a new row of responses.
    c. How do I code R Shiny to say - If the participant answers "apple" then give it questions from apple.csv

  2. Participants rate the fruits in the Main Question on a scale of 1-4. Then, the F/u questions show up in the order that they ordered the fruits in.
    a. Not ideal because then I would have to code for all 24 possible answers choices from the Main Question.
    b. How would I create a "fill in the blank" or number ordering type of question where the sequence of numbers can then be read in and used to determine which of 24 question csv files the participant would get.

  3. Have the Main Question in the side bar and link to the other questions in the side bar as well (i.e. "What is your favorite fruit? Click on the links below in the order of your fruit" Sidebar would have links to each of the 4 sets of f/u questions).
    a. Again issue with if people forgot which fruit's followup questions they already answered.
    b. Would this give me the order that people answered the questions in? And if so how?

I looked up conditional panels but I don't think that's what I'm looking for? Or perhaps I don't fully understand how to use them. Also, I have to be able to a) determine the order of fruit favoritism somehow and b) each question must be geared toward the specific fruit even if the question is otherwise exactly identical.

My Current Code: based on Francis Smart Econometrics for Simulation

Thanks in advance!