R - dbplyr - `lang_name()` 已弃用

标签 r dbplyr

我刚刚更新了 dblyr,从那一刻起我开始看到警告

Warning messages: 1: lang_name() is deprecated as of rlang 0.2.0. Please use call_name() instead. This warning is displayed once per session. 2: lang() is deprecated as of rlang 0.2.0. Please use call2() instead. This warning is displayed once per session.

我不知道我应该做什么,因为我的代码看起来像这样

df <- tbl(conn, in_schema("schema", "table")) %>%
filter(status!= "CLOSED" | is.na(status)) %>%
      group_by(customer_id) %>%
      filter(created == min(created, na.rm = T)) %>%
      ungroup() %>%
      select(
        contract_number,
        customer_id,
        approved_date = created 
      ) %>%
      collect() 

我的代码中没有 call_name() 或 lang_name() 。你们知道出了什么问题吗?我知道即使有此警告,我的代码也可以工作,但我不想看到它。

最佳答案

正如您已经提到的,没有任何问题,您的代码工作正常,因为这是一个警告。 dbplyr 中的窗口函数仍然使用 lang_name() 函数调用。窗口函数在 filter( ... == min(...)) 语句中调用。 Github 上已经有一个针对此问题的问题 link

如果您不想看到警告,可以像这样抑制它:

suppressWarnings(df <- tbl(conn, in_schema("schema", "table")) %>%
filter(status!= "CLOSED" | is.na(status)) %>%
      group_by(customer_id) %>%
      filter(created == min(created, na.rm = T)) %>%
      ungroup() %>%
      select(
        contract_number,
        customer_id,
        approved_date = created 
      ) %>%
      collect())

关于R - dbplyr - `lang_name()` 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57977202/

相关文章:

json - 如何在 R 中使用管道工 api 返回 JSON

java - 无法在 RStudio 中加载 rJava

r - r中的组合锻炼

r - 使用 R 连接到远程 SQL Server

r - 在 R 中高效使用 Choleski 分解

r - dbplyr copy_to 不将表保存到数据库

r - 使用 dbplyr 进行数据库计算

sql - 如何在 SQL 数据库上使用 dplyr `distinct()` 函数?

r - filter() 如何使用变量来过滤数据库支持的 tibble?

r - 如何在 dbplyr 中使用 R 代码创建自定义 SQL 函数?