From dfcc514a42ea5215d61113aea88c4f15693d2775 Mon Sep 17 00:00:00 2001 From: Jeff Evans Date: Fri, 22 Jul 2016 16:54:35 -0500 Subject: [PATCH] Putting clauses on same line to avoid silent error --- SOUPTONUTS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SOUPTONUTS.md b/SOUPTONUTS.md index ddb8618..00ee0ba 100644 --- a/SOUPTONUTS.md +++ b/SOUPTONUTS.md @@ -196,8 +196,7 @@ The title "Miss" should help with differentiation betweeen younger and older fem ## function for extracting honorific (i.e. title) from the Name feature getTitle <- function(data) { title.dot.start <- regexpr("\\,[A-Z ]{1,20}\\.", data$Name, TRUE) - title.comma.end <- title.dot.start - + attr(title.dot.start, "match.length")-1 + title.comma.end <- title.dot.start + attr(title.dot.start, "match.length")-1 data$Title <- substr(data$Name, title.dot.start+2, title.comma.end-1) return (data$Title) }