Skip to content

scale_y_continuous() fails if inside a function called via double colon pkg::fun(...) #5436

Closed
@averissimo

Description

@averissimo

I found a problem with recent PR #5343 when scale_y_continuous was called inside a package function via double colon

I expected the function not to throw an error

Here is the code to reproduce the bug:

Please note that the problem is not with {tern} itself, as the call without double colon succeeds

install.package("tern")
remotes::install_github("tidyverse/ggplot2")

library(tern)

# example from tern::g_lineplot function
library(nestcolor)

adsl <- tern_ex_adsl
adlb <- tern_ex_adlb %>% dplyr::filter(ANL01FL == "Y", PARAMCD == "ALT", AVISIT != "SCREENING")
adlb$AVISIT <- droplevels(adlb$AVISIT)
adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min))
g_lineplot(adlb, adsl, subtitle = "Laboratory Test:")

# This call falls on if clause `... && !startsWith(as.character(call[[1]]), "scale_")` as it has length = 3
tern::g_lineplot(adlb, adsl, subtitle = "Laboratory Test:")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions