surveydown::sd_create_survey("path/to/folder")
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:
This will create a folder located at "path/to/folder"
with the following files:
-
survey.qmd
: a template survey where you define your survey content (text, questions, images, etc.). -
app.R
: a template app file where you define your database connection, survey configuration options, and any other server logic. -
survey.Rproj
: An RStudio project file (helpful if you’re working in RStudio)
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 thesd_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.