Skip to content

Inconsistent behavior in colwise verbs when quosure is supplied #4330

@echasnovski

Description

@echasnovski

In current dplyr GitHub version (commit 792ca49) there is an inconsistent treatment of quosures in colwise verbs:

suppressPackageStartupMessages(library(dplyr))
library(rlang)

df <- mtcars[1:5, ]

transmute_at(df, vars(mpg), ~ . > mean(.))
#>     mpg
#> 1  TRUE
#> 2  TRUE
#> 3  TRUE
#> 4  TRUE
#> 5 FALSE
# This throws error "Object '.' is not found"
transmute_at(df, vars(mpg), quo(. > mean(.)))
#> Error in ~. > mean(.): объект '.' не найден

summarise_at(df, vars(mpg), ~ mean(.))
#>     mpg
#> 1 20.98
summarise_at(df, vars(mpg), quo(mean(.)))
#>     mpg
#> 1 20.98

Created on 2019-04-13 by the reprex package (v0.2.1)

And could you please tell me: by current design, should I be able to pass quosures in .funs? In docs it says that .funs can be "...a quosure style lambda ~ fun(.)...".

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