Skip to content

Commit 172c0a7

Browse files
Update like.R (#7104)
1 parent ad2e22d commit 172c0a7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

R/like.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Don't use * or % like SQL's like. Uses regexpr syntax - more powerful.
33
# returns 'logical' so can be combined with other where clauses.
44
like = function(vector, pattern, ignore.case = FALSE, fixed = FALSE, perl = FALSE) {
5+
# TODO(R>=4.1.0): grepl itself has "smarter" logic for factor input.
56
if (is.factor(vector)) {
67
# indexing by factors is equivalent to indexing by the numeric codes, see ?`[` #4748
78
ret = grepl(pattern, levels(vector), ignore.case = ignore.case, fixed = fixed, perl = perl)[vector]

0 commit comments

Comments
 (0)