Attach or Update a Survey Entry in a Project Object
Source:R/dl_project_attach_survey.R
dl_project_attach_survey.RdAdds or updates survey metadata within a Project object stored in S3.
The function automatically reads the current project version from S3,
attaches or updates a survey entry, and writes the updated object back.
Each wave holds at most one survey: attaching to a wave that already holds
one replaces that entry.
Usage
dl_project_attach_survey(
external_id = NA_character_,
wave = NA_character_,
type = "forsta",
data = NULL,
project = dl_get_project(),
env = "prod"
)Arguments
- external_id
Character. External survey identifier (e.g., Forsta or Qualtrics ID). Required for
"forsta"and"qualtrics"types.- wave
Character. Optional survey wave label. Defaults to
NA_character_. Waves are unique within a project: attaching to a wave that already holds a survey replaces that entry. Usedl_project_detach_survey()to remove an entry.- type
Character. Survey type — one of
"forsta","qualtrics", or"direct". Defaults to"forsta". If"direct",datamust be provided. Whentypeis not given anddatais provided withoutexternal_id, the type switches to"direct"automatically.- data
Optional data frame containing survey responses. For
"direct"surveys, this is required and stored directly. For"forsta"and"qualtrics", data may be provided, overriding live download.- project
Character. Project ID to load from S3. Defaults to
dl_get_project(). Must refer to an existing project initialized withdl_project_init().- env
Datalake environment (
"prod"or"test"). Default"prod".
Details
If the project does not exist in S3, an error is raised instructing
the user to initialize it first with dl_project_init().
If no changes are detected, the function confirms that the project
is already in sync.