ChatStat is an R package to get data from online chat platforms, in tidy formats. It currently only supports Matrix, but more backends are planned.
Come talk in #rmatrixstats:matrix.org to discuss ChatStat or get help using it!
You can install the development version of ChatStat from GitHub with:
# install.packages("remotes")
remotes::install_github("GregSutcliffe/ChatStat")
If you’re new to R, go with this:
# install R from your package manager
mkdir chatstats && cd chatstats
Rscript -e 'install.packages("renv")'
Rscript -e 'renv::init()'
Rscript -e 'install.packages("remotes")'
Rscript -e 'remotes::install_github("GregSutcliffe/ChatStat")'
R
Which will set up a new renv
environment with ChatStat installed and
ready to use.
You will need your access_token
and your homeserver URL, and
optionally a port if your homeserver is non-standard:
# Authentication
Sys.setenv('token' = 'syt_foobarbaz',
'host' = 'matrix.org')
You can then get a JSON list of events by providing a roomID that you access to:
library(ChatStat)
df <- room_history('!layMvdZSboJeKiyTAL:matrix.org', # rmeta:matrix.org
since = '2021-12-01 00:00:00')
length(df)
See https://spec.matrix.org/v1.1/client-server-api/ for more details of the Matrix Client-Server API Spec