addkey {fsia}R Documentation

Add a Key to a Data Frame

Description

Adds the correct responses (key) to a data frame.

Usage

addkey(obj, keyline = NULL, keyfile = NULL, keydata = NULL)

Arguments

obj

An object containing the data imported by function read.formscanner.

keyline

the number of line of the data containing the correct responses to the items. This line is deleted from the data and used as key.

keyfile

the name of the file with the correct responses to the items. Column names should match the names of the items.

keydata

an R data frame containing the correct responses to the items. Column names should match the names of the items.

Details

keyfile and keydata can contain more items than obj. In this case, items not contained in obj are dropped in the output.

Value

A list with data, key, and eventually weights.

Author(s)

Michela Battauz

See Also

addweights

Examples

data(test)
data(key)
testk <- addkey(test, keydata = key)

[Package fsia version 1.1.1 Index]