setItemText: Associate Text with Variables

View source: R/itemanalysis.R

setItemTextR Documentation

Associate Text with Variables

Description

setItemText can be used to associate text (usually the item stem or a description of it) with the variables (items) in a data frame.

Usage

setItemText(x, items = NULL)

Arguments

x

a data frame

items

either a character vector containing the descriptions of the items (columns in the data frame) or the name of a file containing the descriptions for the items. If a file name is given, each of the descriptions must occupy one line and each item in the data frame must have a description.

Details

Technically, setItemText sets the item.text attribute for the variables (items) in a data frame, which corresponds to "variable labels" known form other statistical systems. This text is then displayed along with the variable name in functions such as classifyItems as a mnemonic for the content of the item.

The text can be specified either as a character vector of the same length as the number of the columns in the data frame or in a text file that contains the descriptions of the items. The file is read via read.table, with the separator set to a newline character (i.e., "\n") Consequently, each description must occupy exactly one physical line (which may, of course, span several display lines). The number of descriptions in the file and the number of items must be the same.

Notice that attributes are lost when data frames are subsetted via subset. For preserving the item.text attribute, select or filter can be used instead of subset.

Value

A data frame with the item.text attribute set for variable.

Author(s)

Michael Hock michael.hock@uni-bamberg.de

See Also

getItemText for retrieving item.text attributes.


mihock/iana documentation built on Jan. 14, 2024, 8:58 p.m.