Start with a Template

We recommend starting with a template to build your surveydown survey.

In the R console, run the following to to setup a template survey:

surveydown::sd_create_survey("path/to/folder")

This will create a folder located at "path/to/folder" with the following files:

Important

Every survey created with {surveydown} should be in its own separate project folder.

Single vs Multiple File Structure

The app.R file defines the Shiny app, which by default is a single file. If you wish to define your app using separate files, you can do so by setting the structure argument to "multi" in the sd_create_survey() function. This will create a template with four files:

surveydown::sd_create_survey("path/to/folder", structure = "multi")
  • survey.qmd: a template survey where you define your survey content (text, questions, images, etc.).
  • ui.R: The main UI file for the Shiny app. It will only contain the sd_ui() function.
  • server.R: a template server file where you define the server logic of the app.
  • global.R: a template global file where you define any global variables, libraries, or functions.
Back to top