if (interactive()) {
library(surveydown)
# Get path to example survey file
survey_path <- system.file("examples", "basic_survey.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) {
# sd_server() accepts these following parameters
sd_server(
db = NULL,
required_questions = NULL,
all_questions_required = FALSE,
start_page = NULL,
auto_scroll = FALSE,
rate_survey = FALSE,
language = "en",
use_cookies = TRUE
)
}
# Run the app
shiny::shinyApp(ui = sd_ui(), server = server)
# Clean up
setwd(orig_dir)
}
Run the code above in your browser using DataLab