Skip to content

epix_merge() has unexpected internal error #683

@dajmcdon

Description

@dajmcdon
library(epiprocess)
#> Loading required package: epidatasets
#> Registered S3 method overwritten by 'tsibble':
#>   method               from 
#>   as_tibble.grouped_df dplyr
#> 
#> Attaching package: 'epiprocess'
#> The following object is masked from 'package:stats':
#> 
#>     filter
buggy_list <- readRDS("~/Desktop/buggy_archives.rds")
x <- buggy_list$x
y <- buggy_list$y
epix_merge(x, y)
#> Warning in as.data.table.list(x, key = key, ...): Item 1 has 2896 rows but
#> longest item has 2906; recycled with remainder.
#> Warning in as.data.table.list(x, key = key, ...): Item 2 has 2896 rows but
#> longest item has 2906; recycled with remainder.
#> Warning in as.data.table.list(x, key = key, ...): Item 3 has 2896 rows but
#> longest item has 2906; recycled with remainder.
#> Warning in as.data.table.list(x, key = key, ...): Item 5 has 2896 rows but
#> longest item has 2906; recycled with remainder.
#> Error in `validate_epi_archive()`:
#> ! `x$DT` must have one row per unique combination of the key variables.
#>   If you have additional key variables other than `geo_value`, `time_value`,
#>   and `version`, such as an age group column, please specify them in
#>   `other_keys`. Otherwise, check for duplicate rows and/or conflicting values
#>   for the same measurement.

Created on 2026-01-01 with reprex v2.1.1

I believe that the error happens at

set(result_dt, , y_nonby_colnames, y_dt[result_dt[, by, with = FALSE], 
        y_nonby_colnames, with = FALSE, on = by, roll = TRUE, 
        nomatch = NA, allow.cartesian = TRUE])

The y_dt[...] seems to create extra rows.

buggy_archives.rds.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions