So how should you complete your homework for this class?

Upload one file to Blackboard.

Homework 10:

 Read: Chapter 14

 Exercises:

 Do 14.2.5 Exercises 1, 3
 Do 14.3.2.1 Exercise 2 (This problem should not be turned in bacause of the str_view() makes it 
    so your notebook will not knit.)
 Do 14.4.6.1 Exercise 1
 
 
library(pacman)
p_load("tidyverse", "stringr")

14.2.5

1.

In code that doesn’t use stringr, you’ll often see paste() and paste0(). What’s the difference between the two functions? What stringr function are they equivalent to? How do the functions differ in their handling of NA?

Answer:

The paste() function includes a space at the end of the paste and paste0 does not have a space added at the end.

paste("first", "second")
[1] "first second"
paste0("first", "second")
[1] "firstsecond"

The stringr function that could be used in place of paste0() is str_c()

str_c("first", "second")
[1] "firstsecond"

The str_c() returns an NA if any of the strings are NA. This is different from the paste()

paste("first", NA)
[1] "first NA"
str_c("first", NA)
[1] NA

3.

Use str_length() and str_sub() to extract the middle character from a string. What will you do if the string has an even number of characters?

Answer:

len <- str_length("firost") 
# If len is even
str_sub("first", ceiling(len/2), ceiling(len/2))
[1] "r"
# If len is odd
str_sub("firost", ceiling(len/2), ceiling(len/2)+1)
[1] "ro"
# The mod function computes the remainder of a division problem.  If the reminder is 0 then the length is even.
middle_letter <- function(x){
  if (str_length(x) %% 2 == 0) {   
    middle_letter = str_sub(x, ceiling(len/2), ceiling(len/2)+1)
  } else {
      middle_letter = str_sub(x, ceiling(len/2), ceiling(len/2))
  }
  return(middle_letter)
}
x <- c("first")
middle_letter(x)
[1] "r"

14.3.2.1

2.

Given the corpus of common words in stringr::words, create regular expressions that find all words that:

  • Start with “y”.
  • End with “x”
  • Are exactly three letters long. (Don’t cheat by using str_length()!)
  • Have seven letters or more.
  • Since this list is long, you might want to use the match argument to str_view() to show only the matching or non-matching words.

Answer:

words
  [1] "a"           "able"        "about"       "absolute"    "accept"      "account"     "achieve"    
  [8] "across"      "act"         "active"      "actual"      "add"         "address"     "admit"      
 [15] "advertise"   "affect"      "afford"      "after"       "afternoon"   "again"       "against"    
 [22] "age"         "agent"       "ago"         "agree"       "air"         "all"         "allow"      
 [29] "almost"      "along"       "already"     "alright"     "also"        "although"    "always"     
 [36] "america"     "amount"      "and"         "another"     "answer"      "any"         "apart"      
 [43] "apparent"    "appear"      "apply"       "appoint"     "approach"    "appropriate" "area"       
 [50] "argue"       "arm"         "around"      "arrange"     "art"         "as"          "ask"        
 [57] "associate"   "assume"      "at"          "attend"      "authority"   "available"   "aware"      
 [64] "away"        "awful"       "baby"        "back"        "bad"         "bag"         "balance"    
 [71] "ball"        "bank"        "bar"         "base"        "basis"       "be"          "bear"       
 [78] "beat"        "beauty"      "because"     "become"      "bed"         "before"      "begin"      
 [85] "behind"      "believe"     "benefit"     "best"        "bet"         "between"     "big"        
 [92] "bill"        "birth"       "bit"         "black"       "bloke"       "blood"       "blow"       
 [99] "blue"        "board"       "boat"        "body"        "book"        "both"        "bother"     
[106] "bottle"      "bottom"      "box"         "boy"         "break"       "brief"       "brilliant"  
[113] "bring"       "britain"     "brother"     "budget"      "build"       "bus"         "business"   
[120] "busy"        "but"         "buy"         "by"          "cake"        "call"        "can"        
[127] "car"         "card"        "care"        "carry"       "case"        "cat"         "catch"      
[134] "cause"       "cent"        "centre"      "certain"     "chair"       "chairman"    "chance"     
[141] "change"      "chap"        "character"   "charge"      "cheap"       "check"       "child"      
[148] "choice"      "choose"      "Christ"      "Christmas"   "church"      "city"        "claim"      
[155] "class"       "clean"       "clear"       "client"      "clock"       "close"       "closes"     
[162] "clothe"      "club"        "coffee"      "cold"        "colleague"   "collect"     "college"    
[169] "colour"      "come"        "comment"     "commit"      "committee"   "common"      "community"  
[176] "company"     "compare"     "complete"    "compute"     "concern"     "condition"   "confer"     
[183] "consider"    "consult"     "contact"     "continue"    "contract"    "control"     "converse"   
[190] "cook"        "copy"        "corner"      "correct"     "cost"        "could"       "council"    
[197] "count"       "country"     "county"      "couple"      "course"      "court"       "cover"      
[204] "create"      "cross"       "cup"         "current"     "cut"         "dad"         "danger"     
[211] "date"        "day"         "dead"        "deal"        "dear"        "debate"      "decide"     
[218] "decision"    "deep"        "definite"    "degree"      "department"  "depend"      "describe"   
[225] "design"      "detail"      "develop"     "die"         "difference"  "difficult"   "dinner"     
[232] "direct"      "discuss"     "district"    "divide"      "do"          "doctor"      "document"   
[239] "dog"         "door"        "double"      "doubt"       "down"        "draw"        "dress"      
[246] "drink"       "drive"       "drop"        "dry"         "due"         "during"      "each"       
[253] "early"       "east"        "easy"        "eat"         "economy"     "educate"     "effect"     
[260] "egg"         "eight"       "either"      "elect"       "electric"    "eleven"      "else"       
[267] "employ"      "encourage"   "end"         "engine"      "english"     "enjoy"       "enough"     
[274] "enter"       "environment" "equal"       "especial"    "europe"      "even"        "evening"    
[281] "ever"        "every"       "evidence"    "exact"       "example"     "except"      "excuse"     
[288] "exercise"    "exist"       "expect"      "expense"     "experience"  "explain"     "express"    
[295] "extra"       "eye"         "face"        "fact"        "fair"        "fall"        "family"     
[302] "far"         "farm"        "fast"        "father"      "favour"      "feed"        "feel"       
[309] "few"         "field"       "fight"       "figure"      "file"        "fill"        "film"       
[316] "final"       "finance"     "find"        "fine"        "finish"      "fire"        "first"      
[323] "fish"        "fit"         "five"        "flat"        "floor"       "fly"         "follow"     
[330] "food"        "foot"        "for"         "force"       "forget"      "form"        "fortune"    
[337] "forward"     "four"        "france"      "free"        "friday"      "friend"      "from"       
[344] "front"       "full"        "fun"         "function"    "fund"        "further"     "future"     
[351] "game"        "garden"      "gas"         "general"     "germany"     "get"         "girl"       
[358] "give"        "glass"       "go"          "god"         "good"        "goodbye"     "govern"     
[365] "grand"       "grant"       "great"       "green"       "ground"      "group"       "grow"       
[372] "guess"       "guy"         "hair"        "half"        "hall"        "hand"        "hang"       
[379] "happen"      "happy"       "hard"        "hate"        "have"        "he"          "head"       
[386] "health"      "hear"        "heart"       "heat"        "heavy"       "hell"        "help"       
[393] "here"        "high"        "history"     "hit"         "hold"        "holiday"     "home"       
[400] "honest"      "hope"        "horse"       "hospital"    "hot"         "hour"        "house"      
[407] "how"         "however"     "hullo"       "hundred"     "husband"     "idea"        "identify"   
[414] "if"          "imagine"     "important"   "improve"     "in"          "include"     "income"     
[421] "increase"    "indeed"      "individual"  "industry"    "inform"      "inside"      "instead"    
[428] "insure"      "interest"    "into"        "introduce"   "invest"      "involve"     "issue"      
[435] "it"          "item"        "jesus"       "job"         "join"        "judge"       "jump"       
[442] "just"        "keep"        "key"         "kid"         "kill"        "kind"        "king"       
[449] "kitchen"     "knock"       "know"        "labour"      "lad"         "lady"        "land"       
[456] "language"    "large"       "last"        "late"        "laugh"       "law"         "lay"        
[463] "lead"        "learn"       "leave"       "left"        "leg"         "less"        "let"        
[470] "letter"      "level"       "lie"         "life"        "light"       "like"        "likely"     
[477] "limit"       "line"        "link"        "list"        "listen"      "little"      "live"       
[484] "load"        "local"       "lock"        "london"      "long"        "look"        "lord"       
[491] "lose"        "lot"         "love"        "low"         "luck"        "lunch"       "machine"    
[498] "main"        "major"       "make"        "man"         "manage"      "many"        "mark"       
[505] "market"      "marry"       "match"       "matter"      "may"         "maybe"       "mean"       
[512] "meaning"     "measure"     "meet"        "member"      "mention"     "middle"      "might"      
[519] "mile"        "milk"        "million"     "mind"        "minister"    "minus"       "minute"     
[526] "miss"        "mister"      "moment"      "monday"      "money"       "month"       "more"       
[533] "morning"     "most"        "mother"      "motion"      "move"        "mrs"         "much"       
[540] "music"       "must"        "name"        "nation"      "nature"      "near"        "necessary"  
[547] "need"        "never"       "new"         "news"        "next"        "nice"        "night"      
[554] "nine"        "no"          "non"         "none"        "normal"      "north"       "not"        
[561] "note"        "notice"      "now"         "number"      "obvious"     "occasion"    "odd"        
[568] "of"          "off"         "offer"       "office"      "often"       "okay"        "old"        
[575] "on"          "once"        "one"         "only"        "open"        "operate"     "opportunity"
[582] "oppose"      "or"          "order"       "organize"    "original"    "other"       "otherwise"  
[589] "ought"       "out"         "over"        "own"         "pack"        "page"        "paint"      
[596] "pair"        "paper"       "paragraph"   "pardon"      "parent"      "park"        "part"       
[603] "particular"  "party"       "pass"        "past"        "pay"         "pence"       "pension"    
[610] "people"      "per"         "percent"     "perfect"     "perhaps"     "period"      "person"     
[617] "photograph"  "pick"        "picture"     "piece"       "place"       "plan"        "play"       
[624] "please"      "plus"        "point"       "police"      "policy"      "politic"     "poor"       
[631] "position"    "positive"    "possible"    "post"        "pound"       "power"       "practise"   
[638] "prepare"     "present"     "press"       "pressure"    "presume"     "pretty"      "previous"   
[645] "price"       "print"       "private"     "probable"    "problem"     "proceed"     "process"    
[652] "produce"     "product"     "programme"   "project"     "proper"      "propose"     "protect"    
[659] "provide"     "public"      "pull"        "purpose"     "push"        "put"         "quality"    
[666] "quarter"     "question"    "quick"       "quid"        "quiet"       "quite"       "radio"      
[673] "rail"        "raise"       "range"       "rate"        "rather"      "read"        "ready"      
[680] "real"        "realise"     "really"      "reason"      "receive"     "recent"      "reckon"     
[687] "recognize"   "recommend"   "record"      "red"         "reduce"      "refer"       "regard"     
[694] "region"      "relation"    "remember"    "report"      "represent"   "require"     "research"   
[701] "resource"    "respect"     "responsible" "rest"        "result"      "return"      "rid"        
[708] "right"       "ring"        "rise"        "road"        "role"        "roll"        "room"       
[715] "round"       "rule"        "run"         "safe"        "sale"        "same"        "saturday"   
[722] "save"        "say"         "scheme"      "school"      "science"     "score"       "scotland"   
[729] "seat"        "second"      "secretary"   "section"     "secure"      "see"         "seem"       
[736] "self"        "sell"        "send"        "sense"       "separate"    "serious"     "serve"      
[743] "service"     "set"         "settle"      "seven"       "sex"         "shall"       "share"      
[750] "she"         "sheet"       "shoe"        "shoot"       "shop"        "short"       "should"     
[757] "show"        "shut"        "sick"        "side"        "sign"        "similar"     "simple"     
[764] "since"       "sing"        "single"      "sir"         "sister"      "sit"         "site"       
[771] "situate"     "six"         "size"        "sleep"       "slight"      "slow"        "small"      
[778] "smoke"       "so"          "social"      "society"     "some"        "son"         "soon"       
[785] "sorry"       "sort"        "sound"       "south"       "space"       "speak"       "special"    
[792] "specific"    "speed"       "spell"       "spend"       "square"      "staff"       "stage"      
[799] "stairs"      "stand"       "standard"    "start"       "state"       "station"     "stay"       
[806] "step"        "stick"       "still"       "stop"        "story"       "straight"    "strategy"   
[813] "street"      "strike"      "strong"      "structure"   "student"     "study"       "stuff"      
[820] "stupid"      "subject"     "succeed"     "such"        "sudden"      "suggest"     "suit"       
[827] "summer"      "sun"         "sunday"      "supply"      "support"     "suppose"     "sure"       
[834] "surprise"    "switch"      "system"      "table"       "take"        "talk"        "tape"       
[841] "tax"         "tea"         "teach"       "team"        "telephone"   "television"  "tell"       
[848] "ten"         "tend"        "term"        "terrible"    "test"        "than"        "thank"      
[855] "the"         "then"        "there"       "therefore"   "they"        "thing"       "think"      
[862] "thirteen"    "thirty"      "this"        "thou"        "though"      "thousand"    "three"      
[869] "through"     "throw"       "thursday"    "tie"         "time"        "to"          "today"      
[876] "together"    "tomorrow"    "tonight"     "too"         "top"         "total"       "touch"      
[883] "toward"      "town"        "trade"       "traffic"     "train"       "transport"   "travel"     
[890] "treat"       "tree"        "trouble"     "true"        "trust"       "try"         "tuesday"    
[897] "turn"        "twelve"      "twenty"      "two"         "type"        "under"       "understand" 
[904] "union"       "unit"        "unite"       "university"  "unless"      "until"       "up"         
[911] "upon"        "use"         "usual"       "value"       "various"     "very"        "video"      
[918] "view"        "village"     "visit"       "vote"        "wage"        "wait"        "walk"       
[925] "wall"        "want"        "war"         "warm"        "wash"        "waste"       "watch"      
[932] "water"       "way"         "we"          "wear"        "wednesday"   "wee"         "week"       
[939] "weigh"       "welcome"     "well"        "west"        "what"        "when"        "where"      
[946] "whether"     "which"       "while"       "white"       "who"         "whole"       "why"        
[953] "wide"        "wife"        "will"        "win"         "wind"        "window"      "wish"       
[960] "with"        "within"      "without"     "woman"       "wonder"      "wood"        "word"       
[967] "work"        "world"       "worry"       "worse"       "worth"       "would"       "write"      
[974] "wrong"       "year"        "yes"         "yesterday"   "yet"         "you"         "young"      
str_view(words, "^y", match = TRUE)

str_view(words, "x$", match = TRUE)

# The way we are not supposed to do this.
words_three <- as.data.frame(words) %>% mutate(words_length = str_length(words) ) %>%
  filter(words_length == 3)
words_three
dim(words_three)
[1] 110   2
words_three2 <- str_view(words, "^...$", match = TRUE)
words_three2

str_view(words, ".......", match = TRUE)

14.4.6.1

1.

Split up a string like “apples, pears, and bananas” into individual components.

Answer:

I think the best answer to this question uses the helper function boundary(“word”).

If you gave “, +(and +)?” in place of boundary(“word”) you should be sure you understand what it is doing.

x <- c("apples, pears, and bananas")
str_split(x, ", ")[[1]]
[1] "apples"      "pears"       "and bananas"
str_split(x, boundary("word"))[[1]]
[1] "apples"  "pears"   "and"     "bananas"
LS0tCnRpdGxlOiAnU3RhdC4gNDUwIFNlY3Rpb24gMTogSG9tZXdvcmsgMTAnCmF1dGhvcjogIiBQcm9mLiBFcmljIEEuIFN1ZXNzIgpvdXRwdXQ6CiAgd29yZF9kb2N1bWVudDogZGVmYXVsdAogIGh0bWxfZG9jdW1lbnQ6CiAgICBkZl9wcmludDogcGFnZWQKICBodG1sX25vdGVib29rOiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0Ci0tLQoKU28gaG93IHNob3VsZCB5b3UgY29tcGxldGUgeW91ciBob21ld29yayBmb3IgdGhpcyBjbGFzcz8KCi0gRmlyc3QgdGhpbmcgdG8gZG8gaXMgdHlwZSBhbGwgb2YgeW91ciBpbmZvcm1hdGlvbiBhYm91dCB0aGUgcHJvYmxlbXMgeW91IGRvIGluIHRoZSB0ZXh0IHBhcnQgb2YgeW91ciBSIE5vdGVib29rLgotIFNlY29uZCB0aGluZyB0byBkbyBpcyB0eXBlIGFsbCBvZiB5b3VyIFIgY29kZSBpbnRvIFIgY2h1bmtzIHRoYXQgY2FuIGJlIHJ1bi4KLSBJZiB5b3UgbG9hZCB0aGUgdGlkeXZlcnNlIGluIGFuIFIgTm90ZWJvb2sgY2h1bmssIGJlIHN1cmUgdG8gaW5jbHVkZSB0aGUgIm1lc3NhZ2UgPSBGQUxTRSIgaW4gdGhlIHtyfSwgc28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