Skip to content

as_tsibble generates warning "Using an external vector in selections was deprecated in tidyselect 1.1.0." when passed external vectors as args #321

@baranovskypd

Description

@baranovskypd
library(tsibble)
library(tsibbledata)

# convert to basic dataframe
x <- as.data.frame(aus_retail) 

# directly pass args to as_tsibble - no warning
as_tsibble(x, key = names(x)[1:3], index = names(x)[4])

# pass args as external vectors - warning
period <- names(x)[4]
keys <- names(x)[1:3]

as_tsibble(x, key = keys, index = period)

# # returns: 
# # A tsibble: 64,532 x 5 [1M]
# # Key:       State, Industry, Series ID [152]
# ... 
# Warning message:
#   Using an external vector in selections was deprecated in tidyselect 1.1.0.
# ℹ Please use `all_of()` or `any_of()` instead.
# # Was:
# data %>% select(keys)
# 
# # Now:
# data %>% select(all_of(keys))
# 
# See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
# This warning is displayed once every 8 hours.
# Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
# generated. 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions