kaijagahm / vultureUtils

Utility functions for working with vulture data
Other
4 stars 0 forks source link

spaceTimeGroups: fix .data[[timestampCol]] deprecation #52

Open kaijagahm opened 1 year ago

kaijagahm commented 1 year ago

I have the following code as part of spaceTimeGroups:

timegroupData <- dataset %>% # save information about when each timegroup starts and ends.
    dplyr::select(.data[[timestampCol]], timegroup) %>% # XXX this is deprecated, fix.
    dplyr::group_by(.data$timegroup) %>%
    dplyr::summarize(minTimestamp = min(.data[[timestampCol]]),
                     maxTimestamp = max(.data[[timestampCol]]))

When I run it, I get this warning:

Warning message:
Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0.
ℹ Please use `all_of(var)` (or `any_of(var)`) instead of `.data[[var]]`
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated. 

Yet when I try converting .data[[timestampCol]] to all_of(timestampCol), it tells me that the use of all_of and any_of to pass quoted variable names directly is also deprecated. So, how am I supposed to do this? I don't understand.