Skip to content

Commit 9cf2d2a

Browse files
committed
merge main
2 parents 5d1bcb6 + ab426e9 commit 9cf2d2a

File tree

6 files changed

+357
-10
lines changed

6 files changed

+357
-10
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Type: Package
33
Title: Dataframe Difference Tool
44
Version: 1.1.1
55
Authors@R: c(
6-
person("Craig" ,"Gower-Page" , email = "craig.gower-page@roche.com" , role = c("cre","aut")),
7-
person("Kieran", "Martin" , email = "kieran.martin@roche.com" , role = "aut")
6+
person("Craig" ,"Gower-Page" , email = "craiggower@gmail.com" , role = c("cre","aut")),
7+
person("Kieran", "Martin" , email = "kieranjmartin@gmail.com" , role = "aut")
88
)
99
Description: Functions for comparing two data.frames against
1010
each other. The core functionality is to provide a detailed breakdown of any differences

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2018
2-
COPYRIGHT HOLDER: Craig Gower & Kieran Martin
1+
YEAR: 2025
2+
COPYRIGHT HOLDER: diffdf authors

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 diffdf authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

R/ascii_tables.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ recursive_reduce <- function(.l, .f) {
3232
if (length(.l) != 1) {
3333
.l[[2]] <- .f(.l[[1]], .l[[2]])
3434
return(recursive_reduce(.l[-1], .f))
35-
} else {
36-
return(.l[[1]])
3735
}
36+
.l[[1]]
3837
}
3938

4039
#' invert
@@ -53,7 +52,7 @@ invert <- function(x) {
5352
x2[[i]][[j]] <- x[[j]][[i]]
5453
}
5554
}
56-
return(x2)
55+
x2
5756
}
5857

5958

@@ -202,7 +201,7 @@ as_fmt_char.character <- function(x, add_quotes = TRUE, crop_at = 30, ...) {
202201
# clearly identified in the printed output
203202
x[needs_quotes] <- paste0('"', x[needs_quotes], '"')
204203

205-
return(x)
204+
x
206205
}
207206

208207

@@ -224,7 +223,9 @@ as_fmt_char.default <- function(x, ...) {
224223
#' @rdname as_fmt_char
225224
#' @export
226225
as_fmt_char.POSIXt <- function(x, ...) {
227-
format(x, "%Y-%m-%d %H:%M:%S %Z")
226+
x <- format(x, "%Y-%m-%d %H:%M:%S %Z")
227+
x[is.na(x)] <- "<NA>"
228+
x
228229
}
229230

230231

@@ -270,5 +271,5 @@ get_table <- function(dsin, row_limit = 10) {
270271
),
271272
collapse = "\n"
272273
)
273-
return(msg)
274+
msg
274275
}

tests/testthat/_snaps/miscellaneous.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,247 @@
305305
306306
307307

308+
# `as_ascii_table() can handle missing datetimes (#132)
309+
310+
Code
311+
diffdf(d1, d2, suppress_warnings = TRUE)
312+
Output
313+
Differences found between the objects!
314+
315+
Summary of BASE and COMPARE
316+
==================================================================
317+
PROPERTY BASE COMP
318+
------------------------------------------------------------------
319+
Name d1 d2
320+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
321+
Rows(#) 3 3
322+
Columns(#) 2 2
323+
------------------------------------------------------------------
324+
325+
326+
Not all Values Compared Equal
327+
=============================
328+
Variable No of Differences
329+
-----------------------------
330+
id 1
331+
dt1 1
332+
-----------------------------
333+
334+
335+
========================================
336+
VARIABLE ..ROWNUMBER.. BASE COMPARE
337+
----------------------------------------
338+
id 2 2 NA
339+
----------------------------------------
340+
341+
342+
===========================================================
343+
VARIABLE ..ROWNUMBER.. BASE COMPARE
344+
-----------------------------------------------------------
345+
dt1 2 2024-01-24 14:12:49 UTC <NA>
346+
-----------------------------------------------------------
347+
348+
349+
350+
---
351+
352+
Code
353+
diffdf(d1, d3, suppress_warnings = TRUE)
354+
Output
355+
Differences found between the objects!
356+
357+
Summary of BASE and COMPARE
358+
==================================================================
359+
PROPERTY BASE COMP
360+
------------------------------------------------------------------
361+
Name d1 d3
362+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
363+
Rows(#) 3 3
364+
Columns(#) 2 2
365+
------------------------------------------------------------------
366+
367+
368+
Not all Values Compared Equal
369+
=============================
370+
Variable No of Differences
371+
-----------------------------
372+
dt1 3
373+
-----------------------------
374+
375+
376+
===========================================================
377+
VARIABLE ..ROWNUMBER.. BASE COMPARE
378+
-----------------------------------------------------------
379+
dt1 1 2024-01-10 01:02:03 UTC <NA>
380+
dt1 2 2024-01-24 14:12:49 UTC <NA>
381+
dt1 3 1821-02-01 01:01:01 UTC <NA>
382+
-----------------------------------------------------------
383+
384+
385+
386+
---
387+
388+
Code
389+
diffdf(d5, d6, suppress_warnings = TRUE)
390+
Output
391+
Differences found between the objects!
392+
393+
Summary of BASE and COMPARE
394+
==================================================================
395+
PROPERTY BASE COMP
396+
------------------------------------------------------------------
397+
Name d5 d6
398+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
399+
Rows(#) 50 50
400+
Columns(#) 2 2
401+
------------------------------------------------------------------
402+
403+
404+
Not all Values Compared Equal
405+
=============================
406+
Variable No of Differences
407+
-----------------------------
408+
dt1 25
409+
-----------------------------
410+
411+
412+
First 10 of 25 rows are shown in table below
413+
===========================================================
414+
VARIABLE ..ROWNUMBER.. BASE COMPARE
415+
-----------------------------------------------------------
416+
dt1 1 2010-11-19 19:39:15 UTC <NA>
417+
dt1 3 1960-10-01 07:07:59 UTC <NA>
418+
dt1 5 2056-01-25 04:51:33 UTC <NA>
419+
dt1 7 2013-04-15 17:26:08 UTC <NA>
420+
dt1 9 2047-04-11 19:04:11 UTC <NA>
421+
dt1 11 2015-04-02 04:50:42 UTC <NA>
422+
dt1 13 2022-03-16 00:42:50 UTC <NA>
423+
dt1 15 1998-05-18 10:16:14 UTC <NA>
424+
dt1 17 1981-05-17 14:42:57 UTC <NA>
425+
dt1 19 1972-08-09 04:01:06 UTC <NA>
426+
-----------------------------------------------------------
427+
428+
429+
430+
# `as_ascii_table() can handle missing dates (#132)
431+
432+
Code
433+
diffdf(d1, d2, suppress_warnings = TRUE)
434+
Output
435+
Differences found between the objects!
436+
437+
Summary of BASE and COMPARE
438+
==================================================================
439+
PROPERTY BASE COMP
440+
------------------------------------------------------------------
441+
Name d1 d2
442+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
443+
Rows(#) 3 3
444+
Columns(#) 2 2
445+
------------------------------------------------------------------
446+
447+
448+
Not all Values Compared Equal
449+
=============================
450+
Variable No of Differences
451+
-----------------------------
452+
id 1
453+
dt1 1
454+
-----------------------------
455+
456+
457+
========================================
458+
VARIABLE ..ROWNUMBER.. BASE COMPARE
459+
----------------------------------------
460+
id 2 2 NA
461+
----------------------------------------
462+
463+
464+
==============================================
465+
VARIABLE ..ROWNUMBER.. BASE COMPARE
466+
----------------------------------------------
467+
dt1 2 2024-01-24 <NA>
468+
----------------------------------------------
469+
470+
471+
472+
---
473+
474+
Code
475+
diffdf(d1, d3, suppress_warnings = TRUE)
476+
Output
477+
Differences found between the objects!
478+
479+
Summary of BASE and COMPARE
480+
==================================================================
481+
PROPERTY BASE COMP
482+
------------------------------------------------------------------
483+
Name d1 d3
484+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
485+
Rows(#) 3 3
486+
Columns(#) 2 2
487+
------------------------------------------------------------------
488+
489+
490+
Not all Values Compared Equal
491+
=============================
492+
Variable No of Differences
493+
-----------------------------
494+
dt1 3
495+
-----------------------------
496+
497+
498+
==============================================
499+
VARIABLE ..ROWNUMBER.. BASE COMPARE
500+
----------------------------------------------
501+
dt1 1 2024-01-10 <NA>
502+
dt1 2 2024-01-24 <NA>
503+
dt1 3 1821-02-01 <NA>
504+
----------------------------------------------
505+
506+
507+
508+
---
509+
510+
Code
511+
diffdf(d5, d6, suppress_warnings = TRUE)
512+
Output
513+
Differences found between the objects!
514+
515+
Summary of BASE and COMPARE
516+
==================================================================
517+
PROPERTY BASE COMP
518+
------------------------------------------------------------------
519+
Name d5 d6
520+
Class "tbl_df, tbl, data.frame" "tbl_df, tbl, data.frame"
521+
Rows(#) 50 50
522+
Columns(#) 2 2
523+
------------------------------------------------------------------
524+
525+
526+
Not all Values Compared Equal
527+
=============================
528+
Variable No of Differences
529+
-----------------------------
530+
dt1 25
531+
-----------------------------
532+
533+
534+
First 10 of 25 rows are shown in table below
535+
==============================================
536+
VARIABLE ..ROWNUMBER.. BASE COMPARE
537+
----------------------------------------------
538+
dt1 1 2094-01-18 <NA>
539+
dt1 3 1660-11-17 <NA>
540+
dt1 5 2484-06-02 <NA>
541+
dt1 7 2114-10-26 <NA>
542+
dt1 9 2408-06-23 <NA>
543+
dt1 11 2131-10-07 <NA>
544+
dt1 13 2191-11-05 <NA>
545+
dt1 15 1985-12-25 <NA>
546+
dt1 17 1839-02-01 <NA>
547+
dt1 19 1763-04-22 <NA>
548+
----------------------------------------------
549+
550+
551+

0 commit comments

Comments
 (0)