Skip to content

Commit d76c077

Browse files
committed
Tweak code when [ selects out cols from other_keys
1 parent 7f5c345 commit d76c077

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

R/methods-epi_df.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ summary.epi_df = function(object, ...) {
9999

100100
# Amend additional metadata if some other_keys cols are dropped in the subset
101101
old_other_keys = attr(x, "metadata")$other_keys
102-
if (length(setdiff(old_other_keys, cn)) > 0) {
103-
attr(res, "metadata")$other_keys <- intersect(old_other_keys, cn)
104-
}
102+
attr(res, "metadata")$other_keys <- old_other_keys[old_other_keys %in% cn]
105103

106104
res
107105
}

0 commit comments

Comments
 (0)