Skip to contents

Soft-deprecated: use qes_question(). get_question() keeps working and will not be removed; it prints a one-time notice (see qesR-deprecated).

Usage

get_question(do, q, full = TRUE)

Arguments

do

A data.frame, or the name of one, looked up (read only) in the calling environment and its enclosing environments: the workspace, for a call at top level or from a function or sapply() lambda defined there.

q

Column name whose question text should be returned.

full

Ignored: the full question text is always returned. Setting it to FALSE prints a one-time note.

Value

A character scalar with question text, or NA_character_ (with a warning of class qesR_warning) when none exists.

Details

q must name a column of the data exactly (ignoring case only when that names a single column): get_question(d, "q1") never answers for q10. An unknown name is an error of class qesR_error_unknown_variable that suggests near matches. The text returned is the question of qes_question() when the study is known, else the column's label; when the source cut the question, a warning of class qesR_warning_truncated says so. full no longer changes the result: the text is always the most complete one qesR has.

Examples

demo <- get_qes("qes_demo", quiet = TRUE)
get_question(demo, "Q19")
#> `get_question()` is soft-deprecated; use `qes_question()`. It keeps working and will not be removed.
#> [1] "Si un référendum sur l’indépendance avait lieu vous demandant si vous voulez que le Québec devienne un pays indépendant, voteriez-vous OUI ou voteriez-vous NON?"