Skip to content

Commit 5bd90fd

Browse files
committed
perf: avoid relocate tidyselect overhead
1 parent 8984123 commit 5bd90fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/epi_df.R

+4-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ new_epi_df <- function(x = tibble::tibble(geo_value = character(), time_value =
189189

190190
# Reorder columns (geo_value, time_value, ...)
191191
if (nrow(x) > 0) {
192-
x <- x %>% relocate(all_of(c("geo_value", other_keys, "time_value")), .before = 1)
192+
all_names <- names(x)
193+
ukey_names <- c("geo_value", other_keys, "time_value")
194+
value_names <- all_names[!all_names %in% ukey_names]
195+
x <- x[c(ukey_names, value_names)]
193196
}
194197

195198
# Apply epi_df class, attach metadata, and return

0 commit comments

Comments
 (0)