Markdown-Based Surveys With Quarto Shiny Documents.
Note: This is still a very early-stage project and not quite production ready, though we’re happy if you’d like to try it out and give us feedback!
This project brings together three open source technologies (Quarto, shiny, and supabase) to create dynamic, markdown-based surveys. Here’s the basic concept:
- Design your survey as a Quarto shiny document using markdown and R code.
- Render your doc into a shiny app that can be hosted online and sent to respondents.
- Store your survey responses in a supabase database.
The {surveydown} R package works in tandem with our surveydown Quarto extension to make everything work. After installing the package, we recommend working from one of our template example surveys to design your own.
See the documentation page to get started making your own surveydown survey!
surveydown
was created as a markdown-based alternative to platforms
like Google Forms, Qualtrics, Survey Monkey, etc. Unlike every other
platform, it allows the user to define their entire survey content using
markdown and R code, making the survey itself fully reproducible and
easy to share and collaborate with others. The resulting shiny app for
each survey can be hosted on a number of platforms, like
shinyapps.io or
huggingface, and the survey data collected is
owned by the survey designer in their supabase account. Best of all,
everything is open source and free :)
If you’re curious where this whole idea came from, check out this blog post, which outlines more on the general idea and the motivation for it. The post is now outdated in terms of the overall design, but it provides something of an origin story and some of the motivation for developing this project.
This is a running list of things we’re working on adding to the project:
- show_if (conditionally display question)
- skip_if (conditionally skip to page)
- Set defaults for questions to not have any choices selected on launch.
- Ability to embed markdown inside choice options (like mc buttons in formr)
- Option for
preview = TRUE
(database is ignored) - Export timestamps on each page in the data
- Export timestamps on each question interaction (since this will
increase the data size considerably, maybe add this as
question_times = FALSE
argument) - Option to start at a designated page,
e.g.
start_page = 'page_name'
- A
show_all = TRUE
argument to show all the pages and hidden questions when launched (e.g. to be able to print out the entire survey text). Could also be calledprint_mode = TRUE
. - Set up SCSS to be compatible with Quarto-supported bootstrap themes
- Add an optional progress bar
- Include input checks for
skip_if
andshow_if
(question_id
exists, and data frame names are correct) - Required questions (
required = TRUE
): post a popup if a question is required before allowing next button. Default should berequired = FALSE
. - Form validation: Make sure the user inputs the correct type depending on the question type. (see https://shiny.posit.co/r/reference/shiny/0.14/validate.html)
- Admin page w/password to preview / download data (see https://github.com/daattali/shinyforms)
- User tracking via url parameters: https://shinysurveys.jdtrat.com/articles/surveying-shinysurveys.html#user-tracking
- Deal with cookies so users who close the browser can start back where they left off.
- Add a
sd_get_data()
function so the survey designer can obtain the current survey results from inside the app: https://shinysurveys.jdtrat.com/articles/get-survey-data.html - Question types:
- Multiple choice (single choice)
- Multiple choice (multiple choices)
- Select
- Text
- Numeric
- Multiple choice (button…like formr mc_button)
- Text area
- Date
- Matrix
- Slider
Resources / examples:
- shinysurveys
- shinyforms
- Example of adding JS modules to shiny app (pop up message) - could be useful for adding any number of JS-based features, like pop ups for required questions, JS-based progress bar, etc.
Vignettes for each of the following:
- Quick overview / basic usage
- List of question types and examples
- Question formatting options
- Flow control (conditional skipping and conditional display)
- Setting up the database with supabase
If you use this package for in a publication, please cite it! You can
get the citation by typing citation("surveydown")
into R:
citation("surveydown")