Hacking strings with stringr

Introduction

In this module, we will learn to work with string data in R using stringr. As we did in the earlier modules, we will use a case study to explore the various features of the stringr package. You can download the data for the case study from here or directly import the data using the readr package. Let us begin by installing and loading stringr and a set of other pacakges we will be using.

Case Study

Introduction

• extract domain name from random email ids
• extract image type from url
• extract image dimension from url
• extract extension from domain name
• extract http protocol from url
• extract domain name from url
• extract extension from url
• extract file type from url

Data

mockstring

Sample Data

mock_data <-
mockstring %>%
slice(1:10) %>%
select(email, address, full_name, currency, )