MyNixOS website logo
Description

Discovers Emoji from Text.

Unicodes are not friendly to work with, and not all Unicodes are Emoji per se, making obtaining Emoji statistics a difficult task. This tool can help your experience of working with Emoji as smooth as possible, as it has the 'tidyverse' style.

tidyEmoji

R-CMD-check CRANstatus Lifecycle:stable

The goal of tidyEmoji is to help R users work with text data with the presence of Emoji as easy as possible. The most common text data that falls into this category would be Tweets. When people tweet their emotions, ideas, celebrations, etc., Emoji sometimes appears on their Tweets, making the text rendered more colorful. To researchers/users who want to work with this type of text, it is intriguing to know the information about Emoji appearing in the text. With the help of tidyEmoji, dealing with Emoji is at ease.

Installation

Please install the released version of tidyEmoji from CRAN with:

install.packages("tidyEmoji")

Alternatively, you can install the latest development version from Github with:

# install.packages("devtools")
devtools::install_github("PursuitOfDataScience/tidyEmoji")

Usage

Here a tweet-like dataframe is created for brief demostration.

library(tidyEmoji)
library(dplyr)
tweet_df <- 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\U0001f637.",
                                  "Emoji does not appear in all Tweets",
                                  "A flag \U0001f600\U0001f3c1"))

Emoji Tweets summary

Emoji Tweets are defined as Tweets containing at least one Emoji.

  • emoji_summary():
tweet_df %>%
  emoji_summary(tweets)
#> # A tibble: 1 x 2
#>   emoji_tweets total_tweets
#>          <int>        <int>
#> 1            4            6

emoji_summary() gives an overview of how many Emoji Tweets and Tweet in total the data has.

  • emoji_tweets():
tweet_df %>%
  emoji_tweets(tweets)
#>                                                            tweets
#> 1           I love tidyverse <U+0001F600><U+0001F603><U+0001F603>
#> 2          R is my language! <U+0001F601><U+0001F606><U+0001F605>
#> 3 Wearing a mask<U+0001F637><U+0001F637><U+0001F637><U+0001F637>.
#> 4                                 A flag <U+0001F600><U+0001F3C1>

emoji_tweets() filters out non-Emoji Tweets while preserving the raw data structure.

Popular Emoji Tweets

  • top_n_emojis():
tweet_df %>%
  top_n_emojis(tweets, n = 2)
#> # A tibble: 2 x 4
#>   emoji_name             unicode      emoji_category        n
#>   <chr>                  <chr>        <chr>             <int>
#> 1 face_with_medical_mask "\U0001f637" Smileys & Emotion     4
#> 2 grinning               "\U0001f600" Smileys & Emotion     2

top_n_emojis() returns a tibble about the most popular Emojis in the entire data. n is how many the most popular Emojis users want to output. By default, it is 20.

Emoji extraction

  • emoji_extract_unnest():
tweet_df %>%
  emoji_extract_unnest(tweets)
#> # A tibble: 8 x 3
#>   row_number .emoji_unicode .emoji_count
#>        <int> <chr>                 <int>
#> 1          1 "\U0001f600"              1
#> 2          1 "\U0001f603"              2
#> 3          2 "\U0001f601"              1
#> 4          2 "\U0001f605"              1
#> 5          2 "\U0001f606"              1
#> 6          4 "\U0001f637"              4
#> 7          6 "\U0001f3c1"              1
#> 8          6 "\U0001f600"              1

When looking at the tibble above, it has three columns: row_number, .emoji_unicode, and .emoji_count. row_number is which row each Tweet is located in the raw data. This can give users a global overview of Emoji and count.

  • emoji_extract_nest():

emoji_extract_nest() is analogous to emoji_extract_unnest(), but it preserves the raw data with one extra column .emoji_unicode added.

tweet_df %>%
  emoji_extract_nest(tweets)
#>                                                            tweets
#> 1           I love tidyverse <U+0001F600><U+0001F603><U+0001F603>
#> 2          R is my language! <U+0001F601><U+0001F606><U+0001F605>
#> 3                                 This Tweet does not have Emoji!
#> 4 Wearing a mask<U+0001F637><U+0001F637><U+0001F637><U+0001F637>.
#> 5                             Emoji does not appear in all Tweets
#> 6                                 A flag <U+0001F600><U+0001F3C1>
#>                                           .emoji_unicode
#> 1               <U+0001F600>, <U+0001F603>, <U+0001F603>
#> 2               <U+0001F601>, <U+0001F606>, <U+0001F605>
#> 3                                                       
#> 4 <U+0001F637>, <U+0001F637>, <U+0001F637>, <U+0001F637>
#> 5                                                       
#> 6                             <U+0001F600>, <U+0001F3C1>

Emoji category

  • emoji_categorize():
tweet_df %>%
  emoji_categorize(tweets)
#> # A tibble: 4 x 2
#>   tweets                                                    .emoji_category     
#>   <chr>                                                     <chr>               
#> 1 "I love tidyverse \U0001f600\U0001f603\U0001f603"         Smileys & Emotion   
#> 2 "R is my language! \U0001f601\U0001f606\U0001f605"        Smileys & Emotion   
#> 3 "Wearing a mask\U0001f637\U0001f637\U0001f637\U0001f637." Smileys & Emotion   
#> 4 "A flag \U0001f600\U0001f3c1"                             Smileys & Emotion|F~

Each Emoji Tweet is categorized based on the Emoji(s). If Emojis fall into various categories, the .emoji_category column has | to separate each category.

For more information about tidyEmoji, please refer to the package vignette for a comprehensive introduction.

Metadata

Version

0.1.1

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows