View source: R/read_responses.R
| read_responses | R Documentation |
Loads survey response data and checks that it conforms to the instrument
specification. Column names in the response file must match item IDs defined
in the instrument. Non-item columns are allowed only when declared through
respondent_id, submitted_at, or meta_cols.
read_responses(
x,
instrument,
respondent_id = NULL,
submitted_at = NULL,
meta_cols = NULL,
strict = TRUE
)
x |
A file path to a CSV file, a |
instrument |
An |
respondent_id |
Character or NULL. The name of the column containing unique respondent identifiers. If NULL, no respondent ID column is expected. |
submitted_at |
Character or NULL. The name of the column containing submission timestamps. |
meta_cols |
Character vector or NULL. Additional column names that are not item IDs but should be retained (for example, condition assignment or source URL). |
strict |
Logical. When |
A data.frame with columns ordered as: metadata columns first, then
item columns in instrument order. Unrecognised columns are dropped when
strict = TRUE or appended with a warning when strict = FALSE.
quality_report(), score_scales()
responses <- read_responses(
x = system.file("extdata", "tourism_services_responses.csv",
package = "surveyframe"),
instrument = read_sframe(
system.file("extdata", "tourism_services_demo.sframe",
package = "surveyframe")
),
respondent_id = "respondent_id",
submitted_at = "submitted_at",
meta_cols = "started_at"
)
head(responses[, c("respondent_id", "visit_type", "dm_1")])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.