Skip to Content
R Programming Fundamentals
book

R Programming Fundamentals

by Kaelen Medeiros
September 2018
Beginner
206 pages
4h 27m
English
Packt Publishing
Content preview from R Programming Fundamentals

Using stringr Package to Manipulate a Vector of Names

Herein, we will utilize the str_split() function to learn how to split character strings in R. In order to do so, the following steps need to be executed:

  1. Install and then load the stringr package:
install.packages("stringr") library(stringr)
  1. Create the names vector, a list of various names, and check its length to see how many names it contains:
names <- c("Danelle Lewison", "Reyna Wieczorek", "Jaques Sola", "Marcus Huling", "Elvis Driver", "Chandra Picone", "Alejandro Caffey", "Shawnna Lomato", "Masako Hice", "Wally Ota", "Phillip Batten", "Denae Rizzuto", "Joseph Merlos", "Maurice Debelak", "Carina Gunning", "Tama Moody") length(names) 
  1. Use str_split() to separate each name into ...
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.
Start your free trial

You might also like

R Programming Fundamentals

R Programming Fundamentals

Samik Sen, Marcin Dubel
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781789612998Supplemental Content