Skip to content

Fix some minor bugs in autoplot.epi_archive #667

Open
@brookslogan

Description

@brookslogan

It aborts when given an archive containing a single version, or when attempting to plot multiple signals (following autoplot.epi_{df,archive} docs for ...).

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
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

# Single version
tibble(geo_value = 1, time_value = as.Date("2020-01-01") - 1 + 1:5, version = as.Date("2020-01-01") + 6, value1 = 1:5, value2 = 1:5) %>% as_epi_archive() %>% autoplot(value1)
#> Error in seq.int(from = unclass(from), to = unclass(to), by = by): wrong sign in 'by' argument

# Multiple signals
tibble(geo_value = 1, time_value = as.Date("2020-01-01") - 1 + 1:5, version = time_value + 1, value1 = 1:5, value2 = 1:5) %>% as_epi_archive() %>% autoplot(value1, value2)
#> Error in `dplyr::mutate()`:
#> ℹ In argument: `.facets = interaction(geo_value, .response_name, sep = "
#>   / ")`.
#> Caused by error:
#> ! object '.response_name' not found

Created on 2025-05-14 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions