Strings

Introduction

This chapter introduces you to string manipulation in R. You'll learn the basics of how strings work and how to create them by hand, but the focus of this chapter will be on regular expressions or regexps for short. Regular expressions are useful because strings usually contain unstructured or semi-structured data, and regexps are a concise language for describing patterns in strings. When you first look at a regexp, you'll think a cat walked across your keyboard, but as your understanding improves, they will soon start to make sense.


Prerequisites

This chapter will focus on the stringr package for string manipulation, which is part of the core tidyverse.

 library(tidyverse)


Source: H. Wickham and G. Grolemund, https://r4ds.had.co.nz/strings.html
Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 3.0 License.