Comparison of data sets
compare will take two data.frames (or objects of class
and compare them for equality. This is useful to check for typos before you calculate the results with
klausur. If you need to type in the given answers by hand,
so it is advisable to input all data at least twice (perhaps by different persons) and check for differences
with this function,
which can then be corrected by looking up the original answer in the test.
1 2 3
The data sets to be compared. Can be two data.frames or objects of class
A vector with variables that should be compared,
all others are omitted. At least all the values given in
A vector with variables that should be dropped from both sets. See also
A named vector defining if variables in
Logical. Indicates wheter whitespace in character variables should be trimmed.
A named list of character vectors to help identify differing cases in the input data. The element names of this list will become column names in the generated output table, their values define the respective column names of the input data. If a value has more than one element, they will be collapsed into one string for the output.
If you don't want to compare all variables but only a subset,
you can use the
select option (see examples below).
But be careful with this,
at least all the values given in
id are needed to produce the output table.
new.set=TRUE, a new data.frame will be returned,
that is identical in both sets compared, but all dubious values
will be replaced by
new.set=FALSE, a data.frame of the differences, if found (if not,
just a message is returned). Otherwise returns a combined data.frame (see details).
m.eik michalke firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## Not run: data(antworten) # create some differences antworten2 <- antworten[-3, -7] antworten2[4,6] <- NA antworten2[8,8:10] <- antworten2[8,8:10] + 1 # default comparison compare(antworten, antworten2) # compare only variables 1 to 12 compare(antworten, antworten2, select=c(1:12)) # omit variables 3 to 8 and create a new set called "antworten.comp" # from the results antworten.comp <- compare(antworten, antworten2, select=-c(3:8), new.set=TRUE) ## End(Not run)
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.