# remotes::install_github("surveydown-dev/surveydown", force = TRUE)library(surveydown)# Database setup# surveydown stores data on a database that you define at https://supabase.com/# To connect to a database, update the sd_database() function with details# from your supabase database. For this demo, we set ignore = TRUE, which will# ignore the settings and won't attempt to connect to the database. This is# helpful for local testing if you don't want to record testing data in the# database table. See the documentation for details:# https://surveydown.org/store-datadb <-sd_database(host ="aws-0-us-west-1.pooler.supabase.com",dbname ="postgres",port ="6543",user ="postgres.yppmohklyshsiwkpadqa",table ="Woody",ignore =TRUE)# Server setupserver <-function(input, output, session) {# Define any conditional skip logic here (skip to page if a condition is true)sd_skip_if()# Define any conditional display logic here (show a question if a condition is true)sd_show_if( input$penguins =="chinstrap"~"penguins2", input$penguins =="chilly"~"penguins3", input$penguins =="woody"~"penguins4", input$penguins =="gentoo"~"penguins5" )# Database designation and other settingssd_server(db = db )}# shinyApp() initiates your app - don't change itshiny::shinyApp(ui =sd_ui(), server = server)# viola
1
Format for “conditional on response option” is: item == response ~ go-to-item
sd_question(type ="mc",id ="penguins",label ="Which is your favorite type of penguin?",option =c('Chinstrap'='chinstrap','Chilly Willy'="chilly",'Downy WP'='woody',"Gentoo"='gentoo' ))sd_question(type ='mc_buttons',id ='penguins2',label ="Choose a SECOND penguin that is different from the previous",option =c(# 'Chinstrap' = 'chinstrap','Chilly Willy'="chilly",'Downy WP'='woody',"Gentoo"='gentoo' ))sd_question(type ='mc_buttons',id ='penguins3',label ="Choose a SECOND penguin that is different from the previous",option =c('Chinstrap'='chinstrap',# 'Chilly Willy' = "chilly",'Downy WP'='woody',"Gentoo"='gentoo' ))sd_question(type ='mc_buttons',id ='penguins4',label ="Choose a SECOND penguin that is different from the previous",option =c('Chinstrap'='chinstrap','Chilly Willy'="chilly",# 'Downy WP' = 'woody',"Gentoo"='gentoo' ))sd_question(type ='mc_buttons',id ='penguins5',label ="Choose a SECOND penguin that is different from the previous",option =c('Chinstrap'='chinstrap','Chilly Willy'="chilly",'Downy WP'='woody'# "Gentoo" = 'gentoo' ))
1
Only one of these next 4 questions will be displayed, dependent on the previous response given to penguins (the penguins response selection will not be displayed as an option when presenting penguins2) 🐧🐧