Learn R Programming

rwhatsapp

Motivation

rwhatsapp is a small yet robust package that provides some infrastructure to work with WhatsApp text data in R.

WhatsApp seems to become increasingly important not just as a messaging service but also as a social network—thanks to its group chat capabilities. Furthermore, retrieving chat logs from the Android or iOS app is very straightforward: Simply choose More in the menu of a chat, then Export chat and export the history to a txt file.

This package is intended to make the first step of analysing WhatsApp text data as easy as possible: reading your chat history into R. This should work, no matter which device or locale you used to retrieve the txt or zip file containing your conversations.

If you have ideas for what can be useful functions or if you have problems with an existing function, please don’t hesitate to file an issue report.

Installation

install.packages("rwhatsapp")

Or install the GitHub version:

remotes::install_github("JBGruber/rwhatsapp")

Demo

The package comes with a small sample that you can use to get going.

history <- system.file("extdata", "sample.txt", package = "rwhatsapp")

The main function of the package, rwa_read() can handle txt (and zip) files directly, which means that you can simply provide the path to a file to get started:

library("rwhatsapp")
chat <- rwa_read(history)
chat
#> # A tibble: 9 x 6
#>   time                author   text             source          emoji emoji_name
#>   <dttm>              <fct>    <chr>            <chr>           <lis> <list>    
#> 1 2017-07-12 22:35:56 <NA>     "Messages to th… /home/johannes… <NUL… <NULL>    
#> 2 2017-07-12 22:35:56 <NA>     "You created gr… /home/johannes… <NUL… <NULL>    
#> 3 2017-07-12 22:35:56 Johanne… "<Media omitted… /home/johannes… <NUL… <NULL>    
#> 4 2017-07-12 22:35:56 Johanne… "Fruit bread wi… /home/johannes… <chr… <chr [2]> 
#> 5 2017-07-13 09:12:56 Test     "It's fun doing… /home/johannes… <NUL… <NULL>    
#> 6 2017-07-13 09:16:56 Johanne… "Haha it sure i… /home/johannes… <chr… <chr [1]> 
#> 7 2018-09-28 13:27:56 Johanne… "Did you know t… /home/johannes… <NUL… <NULL>    
#> 8 2018-09-28 13:28:56 Johanne… "

Copy Link

Version

Install

install.packages('rwhatsapp')

Monthly Downloads

282

Version

0.2.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Johannes Gruber

Last Published

January 5th, 2022

Functions in rwhatsapp (0.2.4)

lookup_emoji

Lookup emojis from text
emojis

List of emojis and corresponding descriptions.
rwa_read

Read WhatsApp history into R