Closed jaw8 closed 2 years ago
Can you give me a full reprex?
Reprex below. Thank you!
library(compareDF)
df_new <- structure(
list(`Subject Id` = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
.Label = "01-003",
class = "factor"),
`Var Group1Row` = c(1, 2, 3, 4, 5, 6, 7, 8, 9),
`Start Date` = structure(c(18983, 18983, 18983, 18983, 18983, 18985, 18985, 18991, 19012),
class = "Date"),
`End Date` = structure(c(NA, 18991, 18991, 18985, 18985, 18991, 18991, 18998, NA),
class = "Date"),
`Severity Grade` = structure(c(1L, 1L, 3L, 3L, 3L, 2L, 2L, 1L, 1L),
.Label = c("Grade 1 (Mild)",
"Grade 2 (Moderate)",
"Grade 3 (Severe)"),
class = "factor"),
`Con Meds` = c(NA, NA, NA, NA, NA, NA, NA, NA, "6, 7, 10")),
row.names = c(NA, -9L), class = "data.frame")
df_old <- structure(
list(`Subject Id` = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),
.Label = "01-003",
class = "factor"),
`Var Group1Row` = c(1, 2, 3, 4, 5, 6, 7, 8, 9),
`Start Date` = structure(c(18983, 18983, 18983, 18983, 18983, 18985, 18985, 18991, 19012),
class = "Date"),
`End Date` = structure(c(NA, 18991, 18991, 18985, 18985, 18991, 18991, 18998, NA),
class = "Date"),
`Severity Grade` = structure(c(1L, 1L, 3L, 3L, 3L, 2L, 2L, 1L, 1L),
.Label = c("Grade 1 (Mild)",
"Grade 2 (Moderate)",
"Grade 3 (Severe)"),
class = "factor"),
`Con Meds` = c(NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_, NA_character_)),
row.names = c(NA, -9L), class = "data.frame")
keycols <- c('Subject Id', 'Var Group1Row')
compare_compareDF <-
compareDF::compare_df(
df_new = df_new,
df_old = df_old,
group_col = keycols,
keep_unchanged_rows = T,
change_markers = c("NEW", "OLD", "NO CHANGE")
)
#> Found factor columns! Will be casted to character for comparison!
#> Found factor columns! Will be casted to character for comparison!
#> Grouping columns
#> Creating comparison table...
#> Error in as.Date.numeric(value): 'origin' must be supplied
Created on 2022-03-14 by the reprex package (v2.0.1)
Thanks, seems like a bug while comparing the dates - Will fix this soon. In the meantime, can you fix the example with a smaller reprex? This has 38 rows and is impossible to work with @jaw8
Updated reprex.
Thanks for the reprex!
Latest version on master should fix this issues. However - will be some time before I can update CRAN because I had an update very recently only. You can install via devtools for now
Describe the bug When setting
keep_unchanged_rows = T
an error occurs:Error in as.Date.numeric(value) : 'origin' must be supplied
To Reproduce Steps to reproduce the behavior: Normal call of
Setting/keeping default
keep_unchanged_rows = F
does NOT error.Expected behavior No error is expected.
Screenshots .
Desktop (please complete the following information):
OS: Windows 11 Home Version 21H2 OS build 22000.556
R: v4.1.2
RStudio: 2022.02.0 Build 443
Additional context None.