Skip to content

cannot rename count variable to x #7772

@eutwt

Description

@eutwt
df <- data.frame(a = 1)

df |> 
  dplyr::count(a)
#>   a n
#> 1 1 1
df |> 
  dplyr::count(y = a)
#>   y n
#> 1 1 1
df |> 
  dplyr::count(x = a)
#> Error: object 'a' not found

R.version
#>                _                           
#> platform       x86_64-apple-darwin20       
#> arch           x86_64                      
#> os             darwin20                    
#> system         x86_64, darwin20            
#> status                                     
#> major          4                           
#> minor          5.1                         
#> year           2025                        
#> month          06                          
#> day            13                          
#> svn rev        88306                       
#> language       R                           
#> version.string R version 4.5.1 (2025-06-13)
#> nickname       Great Square Root
packageVersion("dplyr")
#> [1] '1.1.4'

Created on 2025-11-19 with reprex v2.1.1

same result with GitHub dplyr
df <- data.frame(a = 1)

df |> 
  dplyr::count(a)
#>   a n
#> 1 1 1
df |> 
  dplyr::count(y = a)
#>   y n
#> 1 1 1
df |> 
  dplyr::count(x = a)
#> Error: object 'a' not found

R.version
#>                _                           
#> platform       x86_64-apple-darwin20       
#> arch           x86_64                      
#> os             darwin20                    
#> system         x86_64, darwin20            
#> status                                     
#> major          4                           
#> minor          5.1                         
#> year           2025                        
#> month          06                          
#> day            13                          
#> svn rev        88306                       
#> language       R                           
#> version.string R version 4.5.1 (2025-06-13)
#> nickname       Great Square Root
packageVersion("dplyr")
#> [1] '1.1.4.9000'

Created on 2025-11-19 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