This function is used to define conditions under which certain pages in the survey should be skipped. It takes one or more formulas where the left-hand side is the condition and the right-hand side is the target page ID.
Value
A list of parsed conditions, where each element contains the condition and the target page ID.
Examples
if (interactive()) {
library(surveydown)
# Get path to example survey file
survey_path <- system.file("examples", "sd_skip_if.qmd",
package = "surveydown")
# Copy to a temporary directory
temp_dir <- tempdir()
file.copy(survey_path, file.path(temp_dir, "survey.qmd"))
orig_dir <- getwd()
setwd(temp_dir)
# Define a minimal server
server <- function(input, output, session) {
# Skip to page based on input
sd_skip_if(
input$fav_fruit == "orange" ~ "orange_page",
input$fav_fruit == "other" ~ "other_page"
)
sd_server()
}
# Run the app
shiny::shinyApp(ui = sd_ui(), server = server)
# Clean up
setwd(orig_dir)
}