sd_create_survey {surveydown} | R Documentation |
This function creates a new survey template by copying files from the package's template directory to a specified path. It handles file conflicts and provides appropriate warnings and feedback.
sd_create_survey(path = getwd(), structure = "single")
path |
A character string specifying the directory where the survey template should be created. Defaults to the current working directory. |
structure |
A character string specifying the template structure to use.
Must be either |
The function performs the following steps:
If the specified path is the current working directory, it asks for user confirmation.
Validates the specified structure ("single"
or "multi"
).
Creates the target directory if it doesn't exist.
Copies all files from the package's template directory (based on the specified structure) to the target path.
Preserves the directory structure of the template.
Skips existing files and provides warnings for each skipped file.
Handles .Rproj files specially, skipping if any .Rproj file already exists in the target directory.
Provides feedback on whether files were copied or if all files already existed.
Invisible NULL
. The function is called for its side effects of
creating files and providing user feedback.
if (interactive()) {
# Create a single-page survey template
sd_create_survey(structure = "single")
# Create a multi-page survey template
sd_create_survey(structure = "multi")
}