Skip to content

Commit

Permalink
Skip the ___retained variable and just filter on the expression. Al…
Browse files Browse the repository at this point in the history
…so conditionally remove the `___row_number` variable if it's not already removed internally by `filter()`.
  • Loading branch information
bschneidr committed May 12, 2021
1 parent 7f2130c commit f240676
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/join.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ semi_join.tbl_svy <- function(
na_matches = na_matches,
...)

x <- mutate(x, `___retained` = `___row_number` %in% filtered_vars[['___row_number']])
x <- filter(x, .data$`___retained`)
x <- select(x, -.data$`___retained`)
x <- filter(x, .data$`___row_number` %in% filtered_vars[['___row_number']])
if ("___row_number" %in% tbl_vars(x)) {
x <- select(x, -`___row_number`)
}

x

Expand Down Expand Up @@ -52,9 +53,10 @@ anti_join.tbl_svy <- function(
na_matches = na_matches,
...)

x <- mutate(x, `___retained` = `___row_number` %in% filtered_vars[['___row_number']])
x <- filter(x, `___retained`)
x <- select(x, -`___retained`)
x <- filter(x, .data$`___row_number` %in% filtered_vars[['___row_number']])
if ("___row_number" %in% tbl_vars(x)) {
x <- select(x, -`___row_number`)
}

x

Expand Down

0 comments on commit f240676

Please sign in to comment.