R Under development (unstable) (2024-02-14 r85901 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(daff) > suppressWarnings(RNGversion("3.5.0")) > set.seed(42) > > df.orig <- data.frame(letters=letters, + ints=1:26, + doubles=(1:26)+0.5, + factors=factor(LETTERS), + LETTERS=LETTERS, + lL=paste (letters, LETTERS), + stringsAsFactors = FALSE, + unchanged=paste0(letters, LETTERS) + ) > df.ref <- df.orig > df <- df.orig > > df$letters <- as.character(df$letters) > df[ 3, "letters"] <- NA > df[ 4, "letters"] <- "" > df[ 5, "letters"] <- LETTERS[5] > df[ 6, "letters"] <- paste0(letters[6], letters[7]) > > # df[ 8, "ints" ] <- NA > # df[ 9, "ints" ] <- 0 > # df[10, "ints" ] <- -1 > > df[13, "doubles"] <- NA > df[14, "doubles"] <- 0.1 > df[15, "doubles"] <- -1.1 > > df[18, "factors"] <- NA > df[19, "factors"] <- LETTERS[26] > > levels(df$factors) <- c(levels(df$factors), letters, "") > df[20, "factors"] <- letters[20] > df[21, "factors"] <- "" > > #df$lL[6:10] <- gsub("^\\s*", "", df.ref$lL[ 6:10]) > df$lL[11:15] <- paste0(" ", df.ref$lL[11:15] ) > df$lL[16:20] <- paste0( df.ref$lL[16:20], " ") > df$lL[21:26] <- paste0(" ", df.ref$lL[21:26], " ") > df.changed <- df > > > ### test > > # test some diff flags > do <- function(x=df.ref, y=df, ..., print=!interactive(), render=interactive()) + { + diff <- diff_data(df.ref, df, ...) + if(print ) print(diff) + if(render) render_diff(diff) + invisible(diff) + } > > # data changes > df <- df.changed > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > # permute rows! > df <- df.orig[sample(nrow(df)),] > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B ... @@ letters ints ... 24:1 : x 24 ... 26:2 : z 26 ... 7:3 g 7 ... 20:4 : t 20 ... 15:5 o 15 ... ... ... ... ... ... 17:21 q 17 ... 1:22 : a 1 ... 25:23 y 25 ... 19:24 : s 19 ... 5:25 : e 5 ... 9:26 : i 9 ... > > # permute cols! > df <- df.orig[, sample(ncol(df))] > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' C:A F:B G:C D:D E:E B:F A:G ! : : : : @@ doubles lL unchanged factors LETTERS ints letters > > # add a row > df <- rbind(df.orig, df.orig[14,]) > df[nrow(df), "ints"] <- 75 > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... z 26 26.5 Z Z z Z zZ +++ n 75 14.5 N N n N nN > > # remove a row > df <- df.orig[-21, ] > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL ... ... ... ... ... ... ... ... ... t 20 20.5 T T t T ... --- u 21 21.5 U U u U ... v 22 22.5 V V v V ... ... ... ... ... ... ... ... ... > > # add a column > df <- cbind(df.orig, addded=1:nrow(df.orig)) > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: ... +++ @@ letters ints ... unchanged addded + a 1 ... aA 1 + b 2 ... bB 2 + c 3 ... cC 3 + d 4 ... dD 4 + e 5 ... eE 5 ... ... ... ... ... ... + u 21 ... uU 21 + v 22 ... vV 22 + w 23 ... wW 23 + x 24 ... xX 24 + y 25 ... yY 25 + z 26 ... zZ 26 > > # remove a column > df <- df.orig[, -3] > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' --- ... @@ letters ints doubles factors ... > > df <- df.changed > # cute use of binary operator! > "%~%" <- function(...) { render_diff(diff_data(...))} > df.ref %~% df.changed > > df.ref <- df.orig > df <- df.changed > do(df.ref, df, always_show_header=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(df.ref, df, always_show_header=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF g 7 7.5 G G g G gG ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > > df.ref <- df.orig > df <- df.changed > do(always_show_order=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(always_show_order=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B C:C D:D E:E F:F G:G @@ letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... 2:2 b 2 2.5 B B b B bB 3:3 -> c->NULL 3 3.5 C C c C cC 4:4 -> d-> 4 4.5 D D d D dD 5:5 -> e->E 5 5.5 E E e E eE ... ... ... ... ... ... ... ... ... 21:21 -> u 21 21.5 U-> U u U-> u U uU 22:22 -> v 22 22.5 V V v V-> v V vV 23:23 -> w 23 23.5 W W w W-> w W wW 24:24 -> x 24 24.5 X X x X-> x X xX 25:25 -> y 25 25.5 Y Y y Y-> y Y yY 26:26 -> z 26 26.5 Z Z z Z-> z Z zZ > > df.ref <- df.orig > df <- df.changed > do(columns_to_ignore=NULL) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(columns_to_ignore=c()) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(columns_to_ignore=c("ints", "letters")) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: doubles factors LETTERS lL unchanged ... ... ... ... ... ... 10.5 J J j J jJ -> 11.5 K K k K-> k K kK -> 12.5 L L l L-> l L lL -> 13.5->NA M M m M-> m M mM -> 14.5->0.1 N N n N-> n N nN ... ... ... ... ... ... -> 21.5 U-> U u U-> u U uU -> 22.5 V V v V-> v V vV -> 23.5 W W w W-> w W wW -> 24.5 X X x X-> x X xX -> 25.5 Y Y y Y-> y Y yY -> 26.5 Z Z z Z-> z Z zZ > do(columns_to_ignore=c("letters")) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... 10 10.5 J J j J jJ -> 11 11.5 K K k K-> k K kK -> 12 12.5 L L l L-> l L lL -> 13 13.5->NA M M m M-> m M mM -> 14 14.5->0.1 N N n N-> n N nN ... ... ... ... ... ... ... -> 21 21.5 U-> U u U-> u U uU -> 22 22.5 V V v V-> v V vV -> 23 23.5 W W w W-> w W wW -> 24 24.5 X X x X-> x X xX -> 25 25.5 Y Y y Y-> y Y yY -> 26 26.5 Z Z z Z-> z Z zZ > > > df.ref <- df.orig > df <- df.changed > do(count_like_a_spreadsheet=NULL, always_show_order=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B C:C D:D E:E F:F G:G @@ letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... 2:2 b 2 2.5 B B b B bB 3:3 -> c->NULL 3 3.5 C C c C cC 4:4 -> d-> 4 4.5 D D d D dD 5:5 -> e->E 5 5.5 E E e E eE ... ... ... ... ... ... ... ... ... 21:21 -> u 21 21.5 U-> U u U-> u U uU 22:22 -> v 22 22.5 V V v V-> v V vV 23:23 -> w 23 23.5 W W w W-> w W wW 24:24 -> x 24 24.5 X X x X-> x X xX 25:25 -> y 25 25.5 Y Y y Y-> y Y yY 26:26 -> z 26 26.5 Z Z z Z-> z Z zZ > do(count_like_a_spreadsheet=TRUE, always_show_order=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B C:C D:D E:E F:F G:G @@ letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... 2:2 b 2 2.5 B B b B bB 3:3 -> c->NULL 3 3.5 C C c C cC 4:4 -> d-> 4 4.5 D D d D dD 5:5 -> e->E 5 5.5 E E e E eE ... ... ... ... ... ... ... ... ... 21:21 -> u 21 21.5 U-> U u U-> u U uU 22:22 -> v 22 22.5 V V v V-> v V vV 23:23 -> w 23 23.5 W W w W-> w W wW 24:24 -> x 24 24.5 X X x X-> x X xX 25:25 -> y 25 25.5 Y Y y Y-> y Y yY 26:26 -> z 26 26.5 Z Z z Z-> z Z zZ > do(count_like_a_spreadsheet=FALSE, always_show_order=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 @@ letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... 2:2 b 2 2.5 B B b B bB 3:3 -> c->NULL 3 3.5 C C c C cC 4:4 -> d-> 4 4.5 D D d D dD 5:5 -> e->E 5 5.5 E E e E eE ... ... ... ... ... ... ... ... ... 21:21 -> u 21 21.5 U-> U u U-> u U uU 22:22 -> v 22 22.5 V V v V-> v V vV 23:23 -> w 23 23.5 W W w W-> w W wW 24:24 -> x 24 24.5 X X x X-> x X xX 25:25 -> y 25 25.5 Y Y y Y-> y Y yY 26:26 -> z 26 26.5 Z Z z Z-> z Z zZ > > > df.ref <- df.orig > df <- df.changed > df$unchanged <- rev(df$unchanged) > df$ints <- sample(nrow(df), 26, replace=TRUE) > do(ids=NULL) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged -> a 1->18 1.5 A A a A aA->zZ -> b 2->1 2.5 B B b B bB->yY -> c->NULL 3->22 3.5 C C c C cC->xX -> d-> 4->1 4.5 D D d D dD->wW -> e->E 5->6 5.5 E E e E eE->vV -> f->fg 6->24 6.5 F F f F fF->uU ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU->fF -> v 22->2 22.5 V V v V-> v V vV->eE -> w 23->20 23.5 W W w W-> w W wW->dD -> x 24->18 24.5 X X x X-> x X xX->cC -> y 25->5 25.5 Y Y y Y-> y Y yY->bB -> z 26->7 26.5 Z Z z Z-> z Z zZ->aA > do(ids=c("ints", "letters")) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged +++ a 18 1.5 A A a A zZ +++ b 1 2.5 B B b B yY +++ 22 3.5 C C c C xX +++ 1 4.5 D D d D wW +++ E 6 5.5 E E e E vV +++ fg 24 6.5 F F f F uU ... ... ... ... ... ... ... ... +++ z 7 26.5 Z Z z Z aA --- v 22 22.5 V V v V vV --- w 23 23.5 W W w W wW --- x 24 24.5 X X x X xX --- y 25 25.5 Y Y y Y yY --- z 26 26.5 Z Z z Z zZ > do(ids=c("")) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged -> a 1->18 1.5 A A a A aA->zZ -> b 2->1 2.5 B B b B bB->yY -> c->NULL 3->22 3.5 C C c C cC->xX -> d-> 4->1 4.5 D D d D dD->wW -> e->E 5->6 5.5 E E e E eE->vV -> f->fg 6->24 6.5 F F f F fF->uU ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU->fF -> v 22->2 22.5 V V v V-> v V vV->eE -> w 23->20 23.5 W W w W-> w W wW->dD -> x 24->18 24.5 X X x X-> x X xX->cC -> y 25->5 25.5 Y Y y Y-> y Y yY->bB -> z 26->7 26.5 Z Z z Z-> z Z zZ->aA > > df.ref <- df.orig > df <- df.changed > do() Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(ignore_whitespace=NULL) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS ... ... ... ... ... ... ... ... b 2 2.5 B B ... -> c->NULL 3 3.5 C C ... -> d-> 4 4.5 D D ... -> e->E 5 5.5 E E ... -> f->fg 6 6.5 F F ... ... ... ... ... ... ... ... -> r 18 18.5 R->NULL R ... -> s 19 19.5 S->Z S ... -> t 20 20.5 T->t T ... -> u 21 21.5 U-> U ... v 22 22.5 V V ... ... ... ... ... ... ... ... > do(ignore_whitespace=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(ignore_whitespace=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS ... ... ... ... ... ... ... ... b 2 2.5 B B ... -> c->NULL 3 3.5 C C ... -> d-> 4 4.5 D D ... -> e->E 5 5.5 E E ... -> f->fg 6 6.5 F F ... ... ... ... ... ... ... ... -> r 18 18.5 R->NULL R ... -> s 19 19.5 S->Z S ... -> t 20 20.5 T->t T ... -> u 21 21.5 U-> U ... v 22 22.5 V V ... ... ... ... ... ... ... ... > > df.ref <- df.orig > df <- df.changed > do() Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(never_show_order=NULL) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(never_show_order=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(never_show_order=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > tmp <- df.changed > tmp <- tmp[sample(nrow(tmp)), ] > do(y=tmp) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(y=tmp, ordered=NULL) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(y=tmp, ordered=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(y=tmp, ordered=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > df.ref <- df.orig > df <- rbind(df.ref[1:20,], df.changed[21:26,]) > do(padding_strategy="auto" ) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... t 20 20.5 T T t T tT -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(padding_strategy="smart" ) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... t 20 20.5 T T t T tT -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(padding_strategy="dense" ) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... t 20 20.5 T T t T tT -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(padding_strategy="sparse") Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... t 20 20.5 T T t T tT -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > df.ref <- df.orig > df <- rbind(df.ref[1:20,], df.changed) > do(show_unchanged=TRUE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged a 1 1.5 A a A b 2 2.5 B b B c 3 3.5 C c C d 4 4.5 D d D e 5 5.5 E e E f 6 6.5 F f F ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(show_unchanged=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... t 20 20.5 T T t T tT +++ a 1 1.5 A A a A aA +++ b 2 2.5 B B b B bB +++ 3 3.5 C C c C cC +++ 4 4.5 D D d D dD ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > > df <- df.orig > df <- cbind(df.changed[,1:2], df.orig[, -c(1:2)]) > do(show_unchanged_columns=TRUE) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF g 7 7.5 G G g G gG ... ... ... ... ... ... ... ... > do(show_unchanged_columns=FALSE) Daff Comparison: 'df.ref' vs. 'df' letters ints doubles ... ... ... ... ... ... b 2 2.5 ... -> c->NULL 3 3.5 ... -> d-> 4 4.5 ... -> e->E 5 5.5 ... -> f->fg 6 6.5 ... g 7 7.5 ... ... ... ... ... ... > > # Test 'meta' changes in column type > df <- cbind(df.changed, df.orig) > df$letters <- factor(df$letters) > df$letters [1] a b E fg g h i j k l m n o [16] p q r s t u v w x y z Levels: E a b fg g h i j k l m n o p q r s t u v w x y z > df$ints <- as.character(df$ints) > df$ints [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" [16] "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" > df$factors <- df$factors > > diff_data(as.data.frame(sapply(df.ref, class)), + as.data.frame(sapply(df, class)) + ) Daff Comparison: 'as.data.frame(sapply(df.ref, class))' vs. 'as.data.frame(sapply(df, class))' (sapply(df.ref, class)) @@ sapply(df, class) +++ factor +++ character +++ numeric +++ factor +++ character +++ character +++ character character ... ... > > do(df.ref, show_unchanged_meta=TRUE) #! doesn't seem to be working!! Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: +++ +++ @@ letters ints doubles factors LETTERS lL unchanged letters.1 ints.1 + a 1 1.5 A A a A aA a 1 + b 2 2.5 B B b B bB b 2 -> c->NULL 3 3.5 C C c C cC c 3 -> d-> 4 4.5 D D d D dD d 4 -> e->E 5 5.5 E E e E eE e 5 ... ... ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU u 21 -> v 22 22.5 V V v V-> v V vV v 22 -> w 23 23.5 W W w W-> w W wW w 23 -> x 24 24.5 X X x X-> x X xX x 24 -> y 25 25.5 Y Y y Y-> y Y yY y 25 -> z 26 26.5 Z Z z Z-> z Z zZ z 26 +++ +++ +++ +++ +++ @@ doubles.1 factors.1 LETTERS.1 lL.1 unchanged.1 + 1.5 A A a A aA + 2.5 B B b B bB -> 3.5 C C c C cC -> 4.5 D D d D dD -> 5.5 E E e E eE ... ... ... ... ... ... -> 21.5 U U u U uU -> 22.5 V V v V vV -> 23.5 W W w W wW -> 24.5 X X x X xX -> 25.5 Y Y y Y yY -> 26.5 Z Z z Z zZ Warning message: In diff_data(df.ref, df, ...) : Column names have been made unique in 'df'. > do(show_unchanged_meta=FALSE) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: +++ +++ @@ letters ints doubles factors LETTERS lL unchanged letters.1 ints.1 + a 1 1.5 A A a A aA a 1 + b 2 2.5 B B b B bB b 2 -> c->NULL 3 3.5 C C c C cC c 3 -> d-> 4 4.5 D D d D dD d 4 -> e->E 5 5.5 E E e E eE e 5 ... ... ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU u 21 -> v 22 22.5 V V v V-> v V vV v 22 -> w 23 23.5 W W w W-> w W wW w 23 -> x 24 24.5 X X x X-> x X xX x 24 -> y 25 25.5 Y Y y Y-> y Y yY y 25 -> z 26 26.5 Z Z z Z-> z Z zZ z 26 +++ +++ +++ +++ +++ @@ doubles.1 factors.1 LETTERS.1 lL.1 unchanged.1 + 1.5 A A a A aA + 2.5 B B b B bB -> 3.5 C C c C cC -> 4.5 D D d D dD -> 5.5 E E e E eE ... ... ... ... ... ... -> 21.5 U U u U uU -> 22.5 V V v V vV -> 23.5 W W w W wW -> 24.5 X X x X xX -> 25.5 Y Y y Y yY -> 26.5 Z Z z Z zZ Warning message: In diff_data(df.ref, df, ...) : Column names have been made unique in 'df'. > > > # Test context vars > df.ref <- df.orig > df <- df.changed > > do(unchanged_column_context=0) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors ... lL ... ... ... ... ... ... ... ... ... b 2 2.5 B ... b B ... -> c->NULL 3 3.5 C ... c C ... -> d-> 4 4.5 D ... d D ... -> e->E 5 5.5 E ... e E ... -> f->fg 6 6.5 F ... f F ... ... ... ... ... ... ... ... ... -> u 21 21.5 U-> ... u U-> u U ... -> v 22 22.5 V ... v V-> v V ... -> w 23 23.5 W ... w W-> w W ... -> x 24 24.5 X ... x X-> x X ... -> y 25 25.5 Y ... y Y-> y Y ... -> z 26 26.5 Z ... z Z-> z Z ... > do(unchanged_column_context=5) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged ... ... ... ... ... ... ... ... b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > do(unchanged_context=0) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF -> k 11 11.5 K K k K-> k K kK -> l 12 12.5 L L l L-> l L lL ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > do(unchanged_context=5) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: letters ints doubles factors LETTERS lL unchanged a 1 1.5 A A a A aA b 2 2.5 B B b B bB -> c->NULL 3 3.5 C C c C cC -> d-> 4 4.5 D D d D dD -> e->E 5 5.5 E E e E eE -> f->fg 6 6.5 F F f F fF ... ... ... ... ... ... ... ... -> u 21 21.5 U-> U u U-> u U uU -> v 22 22.5 V V v V-> v V vV -> w 23 23.5 W W w W-> w W wW -> x 24 24.5 X X x X-> x X xX -> y 25 25.5 Y Y y Y-> y Y yY -> z 26 26.5 Z Z z Z-> z Z zZ > > > # add and reorder column > df <- df.orig[, c(1:2, 4, 3, 5:7)] > df <- cbind(df, added1=1:nrow(df.orig), added2=1:nrow(df.orig)) > do(df.ref, df) Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B D:C C:D E:E F:F G:G -:H -:I ! : +++ +++ @@ letters ints factors doubles LETTERS lL unchanged added1 added2 1:1 + a 1 A 1.5 A a A aA 1 1 2:2 + b 2 B 2.5 B b B bB 2 2 3:3 + c 3 C 3.5 C c C cC 3 3 4:4 + d 4 D 4.5 D d D dD 4 4 ... ... ... ... ... ... ... ... ... ... ... 21:21 + u 21 U 21.5 U u U uU 21 21 22:22 + v 22 V 22.5 V v V vV 22 22 23:23 + w 23 W 23.5 W w W wW 23 23 24:24 + x 24 X 24.5 X x X xX 24 24 25:25 + y 25 Y 25.5 Y y Y yY 25 25 26:26 + z 26 Z 26.5 Z z Z zZ 26 26 > > > # test columns with duplicate names > df.ref <- cbind(df.orig) > df <- cbind(df, df.orig) > do() Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B D:C C:D E:E F:F G:G -:H -:I ! : +++ +++ @@ letters ints factors doubles LETTERS lL unchanged added1 added2 1:1 + a 1 A 1.5 A a A aA 1 1 2:2 + b 2 B 2.5 B b B bB 2 2 3:3 + c 3 C 3.5 C c C cC 3 3 4:4 + d 4 D 4.5 D d D dD 4 4 ... ... ... ... ... ... ... ... ... ... ... 21:21 + u 21 U 21.5 U u U uU 21 21 22:22 + v 22 V 22.5 V v V vV 22 22 23:23 + w 23 W 23.5 W w W wW 23 23 24:24 + x 24 X 24.5 X x X xX 24 24 25:25 + y 25 Y 25.5 Y y Y yY 25 25 26:26 + z 26 Z 26.5 Z z Z zZ 26 26 -:J -:K -:L -:M -:N -:O -:P +++ +++ +++ +++ +++ +++ +++ letters.1 ints.1 doubles.1 factors.1 LETTERS.1 lL.1 unchanged.1 1:1 a 1 1.5 A A a A aA 2:2 b 2 2.5 B B b B bB 3:3 c 3 3.5 C C c C cC 4:4 d 4 4.5 D D d D dD ... ... ... ... ... ... ... ... 21:21 u 21 21.5 U U u U uU 22:22 v 22 22.5 V V v V vV 23:23 w 23 23.5 W W w W wW 24:24 x 24 24.5 X X x X xX 25:25 y 25 25.5 Y Y y Y yY 26:26 z 26 26.5 Z Z z Z zZ Warning message: In diff_data(df.ref, df, ...) : Column names have been made unique in 'df'. > > # test columns with duplicate names v2 > df.ref <- cbind(df.orig, df.orig) > df <- cbind(df, df.orig) > do() Daff Comparison: 'df.ref' vs. 'df' First 6 and last 6 patch lines: A:A B:B D:C C:D E:E F:F G:G -:H -:I ! : +++ +++ @@ letters ints factors doubles LETTERS lL unchanged added1 added2 1:1 + a 1 A 1.5 A a A aA 1 1 2:2 + b 2 B 2.5 B b B bB 2 2 3:3 + c 3 C 3.5 C c C cC 3 3 4:4 + d 4 D 4.5 D d D dD 4 4 ... ... ... ... ... ... ... ... ... ... ... 21:21 + u 21 U 21.5 U u U uU 21 21 22:22 + v 22 V 22.5 V v V vV 22 22 23:23 + w 23 W 23.5 W w W wW 23 23 24:24 + x 24 X 24.5 X x X xX 24 24 25:25 + y 25 Y 25.5 Y y Y yY 25 25 26:26 + z 26 Z 26.5 Z z Z zZ 26 26 H:J I:K J:L K:M L:N M:O N:P -:Q +++ letters.1 ints.1 doubles.1 factors.1 LETTERS.1 lL.1 unchanged.1 letters.2 1:1 a 1 1.5 A A a A aA a 2:2 b 2 2.5 B B b B bB b 3:3 c 3 3.5 C C c C cC c 4:4 d 4 4.5 D D d D dD d ... ... ... ... ... ... ... ... ... 21:21 u 21 21.5 U U u U uU u 22:22 v 22 22.5 V V v V vV v 23:23 w 23 23.5 W W w W wW w 24:24 x 24 24.5 X X x X xX x 25:25 y 25 25.5 Y Y y Y yY y 26:26 z 26 26.5 Z Z z Z zZ z -:R -:S -:T -:U -:V -:W +++ +++ +++ +++ +++ +++ ints.2 doubles.2 factors.2 LETTERS.2 lL.2 unchanged.2 1:1 1 1.5 A A a A aA 2:2 2 2.5 B B b B bB 3:3 3 3.5 C C c C cC 4:4 4 4.5 D D d D dD ... ... ... ... ... ... ... 21:21 21 21.5 U U u U uU 22:22 22 22.5 V V v V vV 23:23 23 23.5 W W w W wW 24:24 24 24.5 X X x X xX 25:25 25 25.5 Y Y y Y yY 26:26 26 26.5 Z Z z Z zZ Warning messages: 1: In diff_data(df.ref, df, ...) : Column names have been made unique in 'df.ref'. 2: In diff_data(df.ref, df, ...) : Column names have been made unique in 'df'. > > proc.time() user system elapsed 2.23 0.34 2.50