Learn R Programming

⚠️There's a newer version (0.10.1) of this package.Take me there.

surveydown

[!IMPORTANT] surveydown is an early stage project under active development and may not yet be a good fit for you. If you are interested in experimenting with it, we welcome your feedback!

[!NOTE] Visit our main site at surveydown.org for the complete documentation and more information about surveydown.

What is surveydown?

surveydown is an open-source, markdown-based platform for interactive and reproducible Surveys using R, Quarto, Shiny, and PostgreSQL databases like Supabase.

Here’s how it works:

  1. Design your survey as a Quarto document using markdown and R code.
  2. Render your survey into a shiny app that can be hosted online and sent to respondents.
  3. Store survey responses in a PostgreSQL database - we recommend Supabase as a free, secure, and easy to use option.

The {surveydown} R package provides functions to bring this all together.

See the complete documentation to get started making your own surveydown survey!

Why surveydown?

Most survey platforms (e.g., Google forms, Qualtrics, etc.) use graphic interfaces or spreadsheets to define survey content, making version control, collaboration, and reproducibility difficult or impossible. The surveydown package was designed to address these problems. As an open-source, markdown-based platform, all survey content is defined using plain text (markdown and R code) in two files:

  • survey.qmd: A Quarto document that contains the survey content (pages, questions, etc).
  • app.R: An R script defining a shiny app that contains global settings (libraries, database configuration, etc.) and server configuration options (e.g., conditional skipping / display, etc.).

This approach makes your survey easy to reproduce, share, and version control with common tools like Git. And since all survey data is stored in a PostgreSQL database, you have total control over where your survey data lives. We provide direct support for Supabase as a free, secure, and easy to use option.

In case you’re interested in the background behind the project, this blog post provides something of an origin story. Note that the design discussed in the post is now quite outdated with what ultimately became surveydown.

Installation

Install R & Quarto

You need both:

We also recommend working with an IDE that has good support for R, Quarto, and Shiny.

RStudio is great, and we also like VSCode and Positron.

Install the {surveydown} R package

You can install {surveydown} from CRAN in your R console:

install.packages("surveydown")

or you can install the development version from GitHub:

# install.packages("pak")
pak::pak('surveydown-dev/surveydown')

Load the package with:

library(surveydown)

You can also check which version you have installed:

surveydown::sd_version()

Roadmap

See our todo repo for a running list of things we’re working on / have already added to the project.

License

See the License.

Citation

If you use this package for in a publication, please cite it! You can get the citation by running citation("surveydown") in your R console:

citation("surveydown")

Copy Link

Version

Install

install.packages('surveydown')

Monthly Downloads

514

Version

0.9.0

License

MIT + file LICENSE

Maintainer

John Helveston

Last Published

March 18th, 2025

Functions in surveydown (0.9.0)

sd_display_question

Create a placeholder for a reactive survey question
sd_include_folder

Include a folder to the 'shiny' resource path
sd_question

Create a survey question
sd_output

Output Function for Displaying reactive objects and values
sd_display_value

Display the value of a survey question
sd_get_data

Fetch data from a database table with automatic reactivity detection
sd_set_password

Set password for surveydown survey
sd_redirect

Create a Redirect Element for 'shiny' Applications
sd_server

Server logic for a surveydown survey
sd_setup

Required Set Up Function
sd_skip_forward

Define forward skip conditions for survey pages
sd_skip_if

Define skip conditions for survey pages (Deprecated)
sd_reactive

Create a reactive value that is also stored in survey data
sd_store_value

Store a value in the survey data
sd_question_custom

Create a Custom Question with a Shiny Widget
sd_ui

Create the UI for a surveydown survey
sd_show_if

Define show conditions for survey questions
sd_show_password

Show the Saved Survey Password
sd_version

Check Surveydown Version
sd_db_config

Configure database settings
sd_database

Connect to a 'PostgreSQL' Database with Automatic Cleanup
sd_completion_code

Generate a Random Completion Code
sd_close

Create a 'Close' Button to Exit the Survey
sd_create_translations

Create a translations template file
sd_copy_value

Create a copy of a value
sd_create_survey

Create a new survey template
sd_is_answered

Check if a question is answered
sd_add_page

Add a Page Template to the Current Document
sd_add_question

Add a Question Template to the Current Document
sd_db_connect

Connect to database
sd_dashboard

Launch Survey Dashboard
sd_next

Create a 'Next' Button for Page Navigation
sd_get_url_pars

Get URL Parameters in a 'shiny' Application