question_text: Returns question text.

View source: R/questions.R

question_textR Documentation

Returns question text.

Description

Given a question id, e.g. "Q4", returns question text for this question. Note that this returns. The functions question_text_unique() and question_text_common() returns the unique and common components of the question text.

Usage

question_text(x, Q)

Arguments

x

A surveydata object

Q

The question id, e.g. "Q4". If not supplied, returns the text for all questions.

Value

character vector

See Also

Other Question functions: question_text_common(), question_text_unique(), questions(), split_common_unique(), which.q()

Examples

# Basic operations on a surveydata object, illustrated with the example dataset membersurvey

class(membersurvey)

questions(membersurvey)

which.q(membersurvey, "Q1")
which.q(membersurvey, "Q3")
which.q(membersurvey, c("Q1", "Q3"))

question_text(membersurvey, "Q3")
question_text_unique(membersurvey, "Q3")
question_text_common(membersurvey, "Q3")

# Extracting columns from a surveydata object

head(membersurvey[, "Q1"])
head(membersurvey["Q1"])
head(membersurvey[, "Q3"])
head(membersurvey[, c("Q1", "Q3")])

# Note that the result is always a surveydata object, even if only one column is extracted

head(membersurvey[, "id"])
str(membersurvey[, "id"])


andrie/surveydata documentation built on March 13, 2023, 2 a.m.