Skip to contents

Keep strings containing an emoji, or find positions

Usage

emoji_subset(string, negate = FALSE)

emoji_which(string, negate = FALSE)

Arguments

string

input vector

negate

If TRUE, inverts the resulting boolean vector.

Value

A character vector

Examples

string <- c(letters[1:4], emoji_name[1:6])

emoji_subset(string) == emoji_name[1:6]
#>                        grinning                   grinning_face 
#>                            TRUE                            TRUE 
#>                          smiley     grinning_face_with_big_eyes 
#>                            TRUE                            TRUE 
#>                           smile grinning_face_with_smiling_eyes 
#>                            TRUE                            TRUE 
emoji_subset(string, negate = TRUE)
#> [1] "a" "b" "c" "d"

emoji_which(string)
#> [1]  5  6  7  8  9 10
emoji_which(string, negate = TRUE)
#> [1] 1 2 3 4