Skip to content

Can we add more context for Can't rename in this context errors? #336

@DavisVaughan

Description

@DavisVaughan

This came up in tidyverse/dplyr#6745

We've started using allow_rename = FALSE more often when our interfaces use tidy selection purely for selection (i.e. when we don't allow named inputs for possible renaming), so this error has popped up more often.

I think it would be useful if we could mention the expression causing the issue, like how we do here:

library(tidyselect)
library(rlang)

eval_select(expr(all_of(x)), mtcars)
#> Error:
#> ! Problem while evaluating `all_of(x)`.
#> Caused by error in `as_indices_impl()`:
#> ! object 'x' not found

I'm imagining something like this for tidyverse/dplyr#6745:

#> Error in `rename_with()`:
#> ! Problem while evaluating `all_of(x)`.
#> ! Can't rename variables in this context.

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