emoji_adoption_lag() compares the date an emoji was first used in your
corpus with the date Unicode released it, giving a per-glyph adoption lag in
days.
Arguments
- data
A data frame or tibble containing a text column. Grouped data frames are accepted. The verbs that work a row at a time (adding columns, or keeping and expanding rows) carry the grouping through to their result, as
dplyr::mutate()anddplyr::filter()do. The verbs that pool across rows – the counts, the co-occurrence edge lists, the time series – warn that they ignore the grouping and return one corpus-wide answer.- text
The text column to scan, supplied unquoted. Any atomic column is accepted and read as character, so a
factorworks and a numeric,Dateor logical one simply contains no emoji. A list column – or a data-frame column – is refused rather than coerced, because coercing one deparses it and the emoji found would be in the code rather than in your data. What counts as an emoji is the same in every verb; see the Detection section of tidyEmoji for the one case that surprises people, code points that are emoji only when they carryU+FE0F.- time
Unquoted column of dates or date-times (
Date,POSIXct, or character in"YYYY-MM-DD"form). A date-time is bucketed by the calendar day it displays as in its own timezone, not by its UTC day: an emoji posted at 23:30 New York time belongs to that day, not to the next one."Its own timezone" means the column's
tzoneattribute. APOSIXctcreated without one – which is whatas.POSIXct("2024-01-01 23:30")and most CSV readers give you – has no timezone of its own, so R displays it in the session's, and the buckets follow. The same column then gives hour 23 on one machine and hour 4 on another. Tag the column (as.POSIXct(x, tz = "UTC"), orlubridate::force_tz()) if the result has to be reproducible; aDatecolumn is immune either way.A character column must lead with a four-digit year:
"2024-01-01"or"2024/01/01", with one- or two-digit month and day, and any trailing time ignored. Values that do not parse warn and are dropped – but a column in which nothing reads as a date is an error rather than a column ofNA, since there would be no time axis left. Note that"01/02/2024"is in the second group: convert a column written that way withas.Date()and its ownformatfirst.
Value
A tibble with one row per emoji, most frequent first and ties
broken by the glyph so the order is fully determined: emoji, name,
n, version, release_date, first_seen and lag_days.
lag_days is NA when the release date of the version is unknown.
Details
A lag is only as good as the corpus window: an emoji released before your
data begins will look adopted on day one, so read the lag together with n
and the span of your data. Negative lags mean the corpus contains a glyph
before its official release date – usually a vendor shipping early, or a
timestamp problem worth investigating.
Occurrences whose time is missing or unparseable are dropped.
Glyphs are canonicalised through the package's codepoint key, so two spellings of one emoji make one row rather than two; see Which spelling comes back in tidyEmoji.
Examples
df <- data.frame(
when = as.Date(c("2021-01-01", "2022-06-01")),
text = c("\U0001f600", "\U0001f97a")
)
emoji_adoption_lag(df, text, when)
#> # A tibble: 2 × 7
#> emoji name n version release_date first_seen lag_days
#> <chr> <chr> <int> <chr> <date> <date> <int>
#> 1 😀 grinning face 1 1.0 2015-06-09 2021-01-01 2033
#> 2 🥺 pleading face 1 11.0 2018-06-05 2022-06-01 1457