How to stop anti_join from reversing sort order in

2019-07-17 00:19发布

I have two sets of names that are ordered A-Z. I'm using anti_join to filter out whatever is present in the 2nd set. Example:

library(dplyr)
t1 <- data.frame(Name = state.name, Abbr = state.abb)
t2 <- data.frame(Abbr = state.abb[50])
t3 <- anti_join(t1, t2, by = "Abbr")

The result is in reverse sort order. I tried adding ascending/descending=TRUE but nothing. Is there a way to keep the sort order intact, without adding another line, that I am missing?

0条回答
登录 后发表回答