Search code examples
rdbplyr

R - dbplyr - `lang_name()` is deprecated


I just updated dblyr and since that moment I started to saw warnings

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.

I have no clue what sould I do since my code looks like this

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() 

There is no call_name() or lang_name() in my code. Do you guys know whats wrong? I know that my code works even with this warnings, but I don't want to see it.


Solution

  • As you already mentioned there is nothing wrong and your code works fine as this is a warning. The window function in dbplyr still uses the lang_name() function call. The window function is called within your filter( ... == min(...)) statements. There is already an issue on Github open for this link.

    If you do not want to see the warning you can suppress it like this:

    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())