df <- data.table(
a = 1:3,
b = 1:3,
c = c("a", "a", "b"),
d = c("a", "a", "b")
)
df %>%
relocate.(c, .before = b)
df %>%
relocate.(a, b, .after = c)
df %>%
relocate.(where(is.numeric), .after = c)
Run the code above in your browser using DataLab