MyNixOS website logo
Description

Explore Twitter Trends with the 'Storywrangler' API.

An interface to explore trends in Twitter data using the 'Storywrangler' Application Programming Interface (API), which can be found here: <https://github.com/janeadams/storywrangler>.

storywranglr

This package makes it easy to explore trends in Twitter data using the Storywrangler application programming interface (API). Data is returned in a tidy tibble to make it easy to work with and visualize.

For more details about Storywrangler, please see:

Installation

You can install the developer version, which has the latest bugfixes and features, with:

devtools::install_github("chris31415926535/storywranglr")

You can install the released version of storywranglr from CRAN with:

install.packages("storywranglr")

Examples

Let’s use storywranglr::ngrams() to chart the popularity of the 2-gram “black friday” over time. Not surprisingly, it looks like there’s an annual peak around Black Friday.

library(storywranglr)
library(tidyverse)

result <- storywranglr::ngrams("black friday")

result %>%
  ggplot(aes(x=date, y=rank)) +
  geom_point() +
  theme_minimal() +
  scale_y_continuous(trans = "reverse") +
  labs(title = "Twitter rank popularity of 2-gram 'black friday'",
       subtitle = "Data from Storywrangler ngrams API",
       x = "Date",
       y = "Rank")

Now using storywrangler::zipf(), let’s find the 10 top 2-grams from January 6, 2021. “the Capitol” made the top 10, and if we got a longer list we could expect to see other thematically related terms.

result <- zipf("2021-01-06", max = 10, ngrams = 2)

knitr::kable(result)
ngramcountcount_no_rtrankrank_no_rtfreqfreq_no_rtoddsdate
of the1327429236481230.00263670.0018889379.25602021-01-06
in the1116763236362340.00221830.0018880450.79872021-01-06
the Capitol813958436875750.00161680.0003490618.50292021-01-06
This is684264140136680.00135920.0011193735.73262021-01-06
to the6105981222638130.00121290.0009766824.49562021-01-06
on the6019551140389150.00119570.0009109836.33392021-01-06
to be5889701697471050.00116990.0013559854.77252021-01-06
Metadata

Version

0.2.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • 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