addweights: Add a Weights to a Data Frame

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Adds the weights associated with the responses to the items to a data frame.

Usage

1
addweights(obj, weightsfile = NULL, weightsdata = NULL)

Arguments

obj

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

weightsfile

the name of the file with the weights. Column names should match the names of the items.

weightsdata

an R data frame containing the weights. Column names should match the names of the items.

Details

If weightsfile and weightsdata have only one row, they should contain the weights that are assigned to the correct responses. These are defined by addkey. To specify a different weight to every response of each item, weightsfile and weightsdata should have one row for each response. In this case there should be a field named response.

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

Value

A list with data, eventually key, and weights.

Author(s)

Michela Battauz

See Also

addkey

Examples

1
2
3
4
5
6
7
data(test)
data(key)
data(weights)
data(weights_multiple)
testk <- addkey(test, keydata = key)
testw <- addweights(testk, weightsdata = weights)
testwm <- addweights(test, weightsdata = weights_multiple)

fsia documentation built on May 2, 2019, 5:42 a.m.