mergeData | R Documentation |
This function merges a list of data frames. Further, it provides detailed diagnostics about value mismatches. If two identically named columns in two datasets do not have identical values, NAs are replaced by valid codes stemming from the other dataset(s) and if two different valid values are found, the first value will be kept and the other dropped, and the user will be informed about the mismatch. 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.
mergeData(newID, datList, oldIDs = NULL, addMbd = FALSE,
overwriteMbdSilently=TRUE, verbose = TRUE)
newID |
A character vector of length 1 indicating the name of the identifier variable (ID) in the merged dataset and/or the name of the ID in every |
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 |
addMbd |
logical. If |
overwriteMbdSilently |
Logical. Whether |
verbose |
logical. If |
A data frame containing unique cases and unique variables. All cases and all variables from the original datasets will be kept and matched.
Karoline Sachse
data(inputDat)
str(inputDat)
mergedDataset <- mergeData("idstud", inputDat, c("ID", "ID", "ID"), addMbd=TRUE)
str(mergedDataset)
mergedDataset <- mergeData("ID", inputDat, verbose=TRUE)
str(mergedDataset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.