Skip to content

Commit eee0784

Browse files
author
Youzhi Yu
committed
initial commit
0 parents  commit eee0784

File tree

10 files changed

+728
-0
lines changed

10 files changed

+728
-0
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^LICENSE\.md$

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.Rproj.user
2+
.Rhistory
3+
.RData
4+
.Ruserdata
5+
inst/doc

DESCRIPTION

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Package: tidyEmoji
2+
Type: Package
3+
Title: Detects Emoji on Text
4+
Version: 0.1.0
5+
Author: Youzhi Yu
6+
Maintainer: Youzhi Yu <[email protected]>
7+
Description: Unicodes are not friendly to work with, and not all Unicodes are
8+
Emoji per se, making obtaining Emoji statistics a not-so-easy task. This
9+
tool can help your experience of working with Emoji as smooth as possible.
10+
License: GPL (>= 3)
11+
Encoding: UTF-8
12+
LazyData: true
13+
RoxygenNote: 7.1.2
14+
Imports:
15+
dplyr,
16+
emoji,
17+
purrr,
18+
rlang,
19+
stringr,
20+
tibble

LICENSE.md

Lines changed: 595 additions & 0 deletions
Large diffs are not rendered by default.

NAMESPACE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(emoji_summary)
4+
import(dplyr)
5+
import(emoji)
6+
import(rlang)
7+
import(stringr)
8+
import(tibble)
9+
importFrom(dplyr,"%>%")
10+
importFrom(purrr,"%||%")

R/emoji-summary.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#' Emoji Summary Tibble
2+
#'
3+
#' @param tweet_tbl A dataframe/tibble containing tweets.
4+
#' @param tweet_text The column that is the tweet column.
5+
#'
6+
#' @return A summary tibble including # of tweets in total and # of tweets that
7+
#' have at least one Emoji.
8+
#'
9+
#' @import dplyr
10+
#' @import emoji
11+
#' @import stringr
12+
#' @import tibble
13+
#' @import rlang
14+
#' @export
15+
#'
16+
17+
18+
emoji_summary <- function(tweet_tbl, tweet_text){
19+
20+
num_tweets <- dim(tweet_tbl)[1]
21+
22+
num_emoji_tweets <- tweet_tbl %>%
23+
dplyr::filter(stringr::str_detect({{ tweet_text }},
24+
emoji::emojis %>%
25+
dplyr::filter(!stringr::str_detect(name, "keycap: \\*")) %>%
26+
dplyr::pull(emoji) %>%
27+
paste(., collapse = "|"))) %>%
28+
dim() %>%
29+
.[1]
30+
31+
return(tibble::tibble(emoji_tweets = num_emoji_tweets,
32+
total_tweets = num_tweets))
33+
34+
}

R/tidyEmoji.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#' \code{tidyEmoji} package
2+
#'
3+
#' A tidy way working with text containing Emoji
4+
#'
5+
#' @docType package
6+
#' @name tidyEmoji
7+
#' @importFrom dplyr %>%
8+
#' @importFrom purrr %||%
9+
NULL
10+
11+
## quiets concerns of R CMD check re: the .'s that appear in pipelines
12+
if(getRversion() >= "2.15.1") utils::globalVariables(c(".", "name"))

man/emoji_summary.Rd

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidyEmoji.Rd

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tidyEmoji.Rproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
AutoAppendNewline: Yes
16+
StripTrailingWhitespace: Yes
17+
18+
BuildType: Package
19+
PackageUseDevtools: Yes
20+
PackageInstallArgs: --no-multiarch --with-keep.source

0 commit comments

Comments
 (0)