if (interactive()) {
library(surveydown)
# Use sd_output() to display reactive questions or values:
# First, define something in server of app.R:
# server <- function(input, output, session) {
# completion_code <- sd_completion_code(10)
# sd_store_value(completion_code)
# sd_server()
# }
# Then, display in R chunks of survey.qmd:
# Your code is: `r sd_output("completion_code", type = 'value')`
# Find a working directory and start from a template:
sd_create_survey(template = "reactive_questions")
# This creates survey.qmd and app.R - launch the survey using app.R
}
Run the code above in your browser using DataLab