









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to string manipulation using the R package 'stringr'. A particular focus is given to regular expressions, which are used to describe patterns in strings. Topics covered include using regular expressions as pattern arguments, character classes, repetition, and shortcuts. The document also includes examples using the NEISS dataset.
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










str_detect(c("R2-D2", "C-3P0"), pattern = START %R% ANY_CHAR %R% one_or_more(DGT)) [1] TRUE FALSE str_view(c("R2-D2", "C-3P0"), pattern = START %R% ANY_CHAR %R% one_or_more(DGT))
or("dog", "cat")
(?:dog|cat) str_view(c("kittycat", "doggone"), pattern = or("dog", "cat"))
str_view(c("apple", "Aaron"), pattern = one_or_more("Aa"))
DOLLAR %R% char_class("0123456789")
$[0123456789] char_class("0-9") [0-9] char_class("a-z") [a-z] char_class("A-Z") [A-Z]
WRD
\w SPC \s
char_class("0-9")
char_class("a-zA-z0-9_")
[a-zA-z0-9_]