Skip to main content
HomeR

Course

String Manipulation with stringr in R

IntermediateSkill Level
4.7+
47 reviews
Updated 11/2022
Learn how to pull character strings apart, put them back together and use the stringr package.
Start Course for Free
RProgramming
4 hr
17 videos
60 Exercises
5,150 XP
32,922
Statement of Accomplishment

Create Your Free Account

Continue with GoogleShow more options

or


By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Loved by learners at thousands of companies

Group

Training a Team?

Try for Business

Course Description

Character strings can turn up in all stages of a data science project. You might have to clean messy string input before analysis, extract data that is embedded in text or automatically turn numeric results into a sentence to include in a report. Perhaps the strings themselves are the data of interest, and you need to detect and match patterns within them. This course will help you master these tasks by teaching you how to pull strings apart, put them back together and use stringr to detect, extract, match and split strings using regular expressions, a powerful way to express patterns.

Prerequisites

Intermediate R
1

String basics

You'll start with some basics: how to enter strings in R, how to control how numbers are transformed to strings, and finally how to combine strings together to produce output that combines text and nicely formatted numbers.
Start Chapter
2

Introduction to stringr

Time to meet stringr! You'll start by learning about some stringr functions that are very similar to some base R functions, then how to detect specific patterns in strings, how to split strings apart and how to find and replace parts of strings.
Start Chapter
3

Pattern matching with regular expressions

4

More advanced matching and manipulation

Now for two advanced ways to use regular expressions along with stringr: selecting parts of a match (a.k.a capturing) and referring back to parts of a match (a.k.a back-referencing). You'll also learn to deal with and strings or patterns that contain Unicode characters (e.g. é).
Start Chapter
5

Case studies

String Manipulation with stringr in R
Course
Complete

Earn Statement of Accomplishment

Add this credential to your LinkedIn profile, resume, or CV
Share it on social media and in your performance review
Enroll Now

Don’t just take our word for it

*4.7
from 47 reviews
81%
15%
4%
0%
0%
  • Thi Phuong Thy
    3 days ago

  • Dario Arles
    3 weeks ago

  • Sarah
    4 weeks ago

  • Dominika
    4 weeks ago

  • Mohammed
    2 months ago

  • Alena
    2 months ago

Thi Phuong Thy

Dario Arles

Dominika

FAQs

Is this course suitable for someone new to working with text data in R?

Yes. It is a beginner-level course that starts with string basics and progressively introduces pattern matching, so no prior text processing experience is needed.

What is the stringr package and why learn it over base R string functions?

The stringr package provides a consistent, readable set of functions for string manipulation in R. It simplifies tasks like detecting, extracting, and replacing text compared to base R.

Will I learn regular expressions in this course?

Yes. Two full chapters are dedicated to regular expressions, covering how to build patterns to detect, extract, match, and split strings effectively.

What practical tasks will I be able to do after completing this course?

You will be able to clean messy string inputs, extract data embedded in text, format numeric output as sentences, and match complex patterns using regular expressions.

How is the course structured across its five chapters?

It moves from string basics and formatting, through core stringr functions, into regular expressions for pattern matching, and finishes with advanced string manipulation techniques.

Join over 19 million learners and start String Manipulation with stringr in R today!

Create Your Free Account

Continue with GoogleShow more options

or


By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.

Grow your data skills with DataCamp for Mobile

Make progress on the go with our mobile courses and daily 5-minute coding challenges.