Strings and Regex

Overview

  • Define Strings, Regular Expressions, and their uses
  • Introduce the stringr() package
  • Practice using Regular Expressions in R to extract info from strings

Before class

Class materials

usethis::use_course("CFSS-MACSS/str-regex") * by typing this into your CONSOLE (and answering R’s version of ‘yes’ twice) and it will AUTOMATICALLY DOWNLOAD to your machine! * tutorial developed from Sabrina Nardin (thanks!)

Additional Resources:

  • stringr() documentation and cheatsheet

  • Chapter 15 by Rochelle Terman, explains stringr() (using the R for Data Science textbook)

  • Read Chapter 17 from R Programming for Data Science. This book covers the entire range of regular expressions packages and functions: you do not need to understand everything, focus on the big picture. In-class we talk about stringr()

  • For more in-depth info on regular expressions check this tutorial

What you need to do after class

  • Homework assignment: finish A3 and start A5.
  • Review today’s lecture materials, and prepare for next class