Skip to contents

Users can use emoji_categorize to see the all the categories each Emoji Tweet has. The function preserves the input data structure, and the only change is it adds an extra column with information about Emoji category separated by | if there is more than one category.

Usage

emoji_categorize(tweet_tbl, tweet_text)

Arguments

tweet_tbl

A dataframe/tibble containing tweets/text.

tweet_text

The tweet/text column.

Value

A filtered dataframe with the presence of Emoji only, and with an extra column .emoji_category.

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
data.frame(tweets = c("I love tidyverse \U0001f600\U0001f603\U0001f603",
                      "R is my language! \U0001f601\U0001f606\U0001f605",
                      "This Tweet does not have Emoji!",
                      "Wearing a mask\U0001f637\U0001f637\U0001f637.",
                      "Emoji does not appear in all Tweets",
                      "A flag \U0001f600\U0001f3c1")) %>%
         emoji_categorize(tweets)
#> # A tibble: 4 × 2
#>   tweets                   .emoji_category        
#>   <chr>                    <chr>                  
#> 1 I love tidyverse 😀😃😃  Smileys & Emotion      
#> 2 R is my language! 😁😆😅 Smileys & Emotion      
#> 3 Wearing a mask😷😷😷.    Smileys & Emotion      
#> 4 A flag 😀🏁              Smileys & Emotion|Flags