如何使来自 `map_dfc()` 的 "New names" 消息静音?

How to silence "New names" message from `map_dfc()`?

假设,我有一个 returns 一个 data.frame 的函数,像这样:

foo<-function(sd){
  data.frame(
    first=rnorm(2,0,sd),
    second=rnorm(2,0,sd/2)
  )
}

现在,当我使用 purrr:map_dfc()foo 生成的 data.frame 中创建单个 data.frame 时,我得到:

map_dfc(1:2, foo)

New names:
* first -> first...1
* second -> second...2
* first -> first...3
* second -> second...4
  first...1 second...2 first...3 second...4
1 0,6905908  0,1499820 -0,685636  1,0323695
2 1,7293986 -0,4653913 -2,049278 -0,2364952

这很好,但是有没有办法让控制台中出现的“新名称”消息静音?

编辑 我知道 suppressMessages() 但它会屏蔽所有可能的消息,而我希望只屏蔽 “新名称”消息。

您可以删除最初收到这些消息的原因。

foo <- function(sd, name){
  tibble::tibble(
    'first_{{name}}' := rnorm(2,0,sd),
    'second_{{name}}' := rnorm(2,0,sd/2)
  )
}

purrr::imap_dfc(1:2, foo)

#  first_1L second_1L first_2L second_2L
#     <dbl>     <dbl>    <dbl>     <dbl>
#1    0.683    -1.25    -2.03      0.801
#2   -1.17      0.530   -0.170    -0.148