Skip to content

Feature request: Suppress message of new names being created in tibble() #1549

Description

@phargarten2

Thanks for making this package. Would you consider passing the quiet argument from vctrs::vec_as_names() to be an argument (say .quiet in tibble::tibble()? The default quiet = FALSE is fine. At times, I would like to suppress the message of new names being created.

This addition would be more useful in the read_xlsx function of the readxl package, which converts Excel files to R tibbles. As Excel files often have messy names, the names will often need to be repaired, which would call vctrs::vec_as_names(). For Excel files that are repetitive (same column structure but different data), I would like to suppress the message of new names being created. But to change readxl, the authors first must pass the argument from a tibble() function to theirs. Other users may benefit from packages that depend on tibble to suppress these messages.

tibble::tibble(x = 1, x = 2, .name_repair = "unique")
#> New names:
#> • `x` -> `x...1`
#> • `x` -> `x...2`
#> # A tibble: 1 × 2
#>   x...1 x...2
#>   <dbl> <dbl>
#> 1     1     2
Created on 2023-06-02 with [reprex v2.0.2](https://reprex.tidyverse.org/)

What I am proposing is the option to remove this message in the tibble() function with the quiet argument (that is passed to vctrs::vec_as_names()):

#> New names:
#> • `x` -> `x...1`
#> • `x` -> `x...2`

Session Info:

#xfun::session_info("tibble")
R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045), RStudio 2023.3.1.446

Locale:
  LC_COLLATE=English_United States.utf8 
  LC_CTYPE=English_United States.utf8   
  LC_MONETARY=English_United States.utf8
  LC_NUMERIC=C                          
  LC_TIME=English_United States.utf8    

Package version:
  cli_3.6.1       fansi_1.0.4     glue_1.6.2      graphics_4.2.3 
  grDevices_4.2.3 lifecycle_1.0.3 magrittr_2.0.3  methods_4.2.3  
  pillar_1.8.1    pkgconfig_2.0.3 rlang_1.1.0     stats_4.2.3    
  **tibble_3.2.1**    utf8_1.2.3      utils_4.2.3     vctrs_0.6.1  

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions