This function creates a new survey template by copying template files to the specified directory. You can choose from various predefined templates, including the default built-in template and specialized templates from the surveydown-dev/templates repository.
Usage
sd_create_survey(path = getwd(), template = "plain_template")
Arguments
- path
A character string specifying the directory where the survey template should be created. Defaults to the current working directory.
- template
A character string specifying the template to use. Default is "plain_template" which uses the built-in package template. Other options include:
- plain_template
The default built-in template
- conditional_display
Template of conditional display of questions
- conditional_navigation
Template of conditional navigation of pages
- conjoint_buttons
Conjoint analysis with button interface
- conjoint_tables
Conjoint analysis with table interface
- custom_leaflet_map
Survey with interactive Leaflet maps
- custom_plotly_chart
Survey with Plotly visualizations
- external_redirect
Template with external site redirects
- live_polling
Live polling template for real-time surveys
- question_types
Showcases all available question types
- random_options
Survey with randomized question options
- random_options_predefined
Randomized options from predefined sets
- reactive_drilldown
Dynamic questions with drill-down capability
- reactive_questions
Survey with reactive questions
Details
When creating a new survey template, this function will:
Check if the specified template is valid
Confirm the destination path with the user (if it's the current directory)
Download template files from GitHub if a non-default template is specified
Copy template files to the destination directory
Skip .Rproj files if one already exists in the destination
Prompt for confirmation before overwriting existing files
External templates are downloaded from the surveydown-dev/templates GitHub repository.
Examples
if (interactive()) {
# Create a survey using the default template
sd_create_survey(path = "my_survey")
# Create a survey with the question_types template
sd_create_survey(path = "question_demo", template = "question_types")
# Create a conditional display survey template
sd_create_survey(path = "conditional_survey", template = "conditional_display")
}