djacobs7
djacobs7

Reputation: 11827

list_len is soft-deprecated as of rlang 0.2.0

I am running some R code and I got the following warning message

Warning message:
`list_len()` is soft-deprecated as of rlang 0.2.0.
Please use `new_list()` instead
This warning is displayed once per session. 

For what it's worth, the calling code looks something like the following

  df = convertCallCountsToHashTable(call_counts_hash_table )

  df %>%
    filter(needs_review) %>%
    filter( package != "R_GlobalEnv") %>%
    top_n( num_functions, desc(review_timer ))

I know that the code in convertCallCountsToHashTable is never directly calling list_len; however it does call some methods from dplyr, tidyr, and lubridate.

How can I do something like traceback to figure out where this warning message is coming from?

How can I make the warning display more than once per session so that I can try to debug it?

Upvotes: 2

Views: 371

Answers (1)

James
James

Reputation: 66844

You can debug list_len, and then use sys.calls to see the function stack. Note that since list_len isn't exported you have to reference the namespace.

my_fun <- function() rlang::list_len(3)
debug(rlang::list_len)
my_fun()
debugging in: rlang::list_len(3)
debug: {
    signal_soft_deprecated(paste_line("`list_len()` is soft-deprecated as of rlang 0.2.0.", 
        "Please use `new_list()` instead"))
    new_list(.n)
}
Browse[2]> sys.calls()
[[1]]
my_fun()

[[2]]
rlang::list_len(3)

Upvotes: 4

Related Questions