With regular expressions we can extract pieces of text

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: en [ ] •  Day, month, year are separated by / •  Year is separated from +me by : Return to St vs St. Another idea > string = "The Slippery St Frances" > chars = unlist(strsplit(string, "")) > chars [1] "T" "h" "e" " " "S" "l" "i" "p" "p" "e" "r" [12] "y" " " "S" "t" " " "F" "r" "a" "n" "c" "e" "s" > possible = which(chars == "S") > possible [1] 5 14 > substring(string, possible, possible + 2) [1] "Sli" "St " > substring(string, possible, possible + 2) == "St " [1] FALSE TRUE What are we doing here? •  • ...
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