TL;DR str_subset(string, pattern) returns the strings that match a pattern. I don’t often need to work with string data, but when I do, I usually jump to two tools: grepl, and stringr. What I usually want to do is return strings that match some pattern. For example, say there are 5 items: items <- c("thing1", "thing2", "sacvy", "item.csv", "wat.csv") Then I can return those items by writing something like …