Getting started
Base R functions to wield regular expressions have been around since the project got started in the form of functions like gsub and grep. It seems, though, that a recent and popular approach is to use the stringr package (which is based on the excellent and more extensive stringi package). Both because the format/argument order of the stringr functions are more consistent than their base R counterparts and because I would like to keep you abreast of popular trends in R programming, we'll be using this package to learn regex in R. Since all of the functions that we'll be using take a string (or vector of strings) to perform regex operations on as the first argument, we'll also be using the magrittr pipe operator (introduced ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access