mergeData: Merge Data Frames, Check For Inconsistencies, and Replace NA...

Description Usage Arguments Value Author(s) Examples

Description

This function merges a list of data frames, checks whether cases with the same value on the identifier variable have different values in different datasets. Additionally, NA resulting from the merge (e.g., in repeated block designs) can be replaced with a customed character missing to facilitate future data preparation of the merged dataset. See collapseMissings for details on supported character missings for other functions in the eatPrep package.

Usage

1
mergeData(newID = "ID", datList, oldIDs=NULL, addMbd = FALSE, verbose=FALSE)

Arguments

newID

A character vector of length 1 indicating the name of the identifier variable in the merged dataset.

datList

A list of data frames to be merged

oldIDs

A character vector or a numeric vector containing either the names of the identifier variables in datList or their column number in each data frame in datList. Default is a vector containing length(datList) replicates of the value of newID.

addMbd

logical. If TRUE, NA is replaced by "mbd" (missing by design) in the merged dataset.

verbose

logical. If TRUE, progress is printed.

Value

A data frame containing unique cases and unique variables. All cases and all variables from the original datasets will be kept and matched.

Author(s)

Karoline Sachse, Nicole Haag

Examples

1
2
3
4
5
6
7
8
data(inputDat)
str(inputDat)

mergedDataset <- mergeData("idstud", inputDat, c("ID", "ID", "ID"), addMbd=TRUE)
str(mergedDataset)

mergedDataset <- mergeData("ID", inputDat, verbose=TRUE)
str(mergedDataset)

eatPrep documentation built on May 2, 2019, 5:20 p.m.

Related to mergeData in eatPrep...