Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b are vectorized). > gsub("St ", "St. ", cNames) [1] "Dewitt County" [2] "Lac qui Parle County" [3] "St. John the Baptist Parish" [4] "Stone County" > strings = c("a test", "and one and one is two", + "one two three") > gsub("one", "1", strings) [1] "a test" "and 1 and 1 is two" "1 two three" > sub("one", "1", strings) [1] "a test" "and 1 and one is two" "1 two three" Regular Expressions to the Rescue Regular Expressions •  Regular expressions give us a powerful way of matching paMerns in text data •  Most importantly, we do this all programa5cally rather than by hand, so that we can easily reproduce our work if needed. With regular expressions, we can •  extract pieces of text – e.g., find all links...
View Full Document

This document was uploaded on 02/16/2014 for the course STATISTICS 3026 at Columbia.

Ask a homework question - tutors are online