class: title-slide <br> <br> .pull-right[ # Working with Strings ## Dr. Mine Dogucu ] --- class: middle center [Friends](https://www.imdb.com/title/tt0108778) --- ```r glimpse(friends) ``` ``` ## Rows: 235 ## Columns: 5 ## $ season <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … ## $ episode <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17… ## $ title <chr> "The One Where Monica Gets a Roommate", "The One with the… ## $ description <chr> "Monica and the gang introduce Rachel to the \"real world… ## $ rating <dbl> 8.3, 8.0, 8.2, 8.1, 8.5, 8.1, 9.0, 8.1, 8.2, 8.1, 8.2, 8.… ``` --- ```r friends$description ``` ``` ## [1] "Monica and the gang introduce Rachel to the \"real world\" after she leaves her fiancé at the altar." ## [2] "Ross finds out his ex-wife is pregnant. Rachel returns her engagement ring to Barry. Monica becomes stressed when her and Ross's parents come to visit." ## [3] "Monica becomes irritated when everyone likes her new boyfriend more than she does. Chandler resumes his smoking habit. Phoebe is given $7000 when she finds a thumb in a can of soda." ## [4] "Joey and Chandler take Ross to a hockey game to take his mind off the anniversary of the first time he slept with Carol, while the girls become depressed when they realize they don't have a 'plan'." ## [5] "Eager to spend time with Rachel, Ross pretends his washroom is rat-infested so he can join her at the laundromat. Meanwhile, Joey has Monica pose as his girlfriend, and Chandler struggles to break up with his girlfriend." ## [6] "Monica's obsessiveness is put to the test after Rachel cleans the apartment. Joey lands a film role as Al Pacino's butt double. Chandler enjoys a relationship with all of the fun but none of the responsibility." ## [7] "When New York suffers from a blackout, Ross tries to tell Rachel that he likes her, and Chandler gets stuck in an ATM vestibule with a model." ## [8] "Monica and Ross mourn the loss of their grandmother. Chandler is shocked to find that people think he is gay." ## [9] "The gang's plans for Thanksgiving go awry after they get locked out of Monica and Rachel's apartment." ## [10] "The gang make (and break) a pact not to bring dates to their New Years Eve party. Phoebe starts dating a scientist. Ross compensates for his loneliness by getting a monkey." ## [11] "Chandler's flamboyant romance-novelist mother comes to visit, and Joey catches her kissing Ross. Meanwhile, Monica and Phoebe fight over a guy in a coma." ## [12] "Rachel and Paolo's relationship hits a snag when he makes a pss at Phoebe. Ross refuses to find out the sex of his baby until it's born. Chandler and Joey go shopping for a new kitchen table." ## [13] "Joey finds out his dad has a mistress. Rachel tries to even the score after Chandler inadvertently catches a glimpse of her breasts. Phoebe dates a shrink who analyzes the gang." ## [14] "As Valentine's Day approaches; Ross and his date end up at the same restaurant as Carol and Susan, Joey inadvertently sets Chandler up on a blind date with Janice, and the girls burn mementos of their old boyfriends." ## [15] "Monica cooks a gourmet meal for a restaurateur who is looking for a new chef, however he arrives at the apartment stoned. Meanwhile, Ross tries to master 'dirty talk'." ## [16] "Phoebe feels neglected when Joey falls for her twin sister. Chandler struggles to fire an attractive co-worker. Ross attends Lamaze classes with Carol and Susan." ## [17] "Rachel switches identities with Monica so she can use her health insurance. Meanwhile, Ursula continues to come between Phoebe and Joey." ## [18] "As Rachel interviews for a new job, the girls take on the guys in a game of poker." ## [19] "The gang frantically search for Ross's monkey Marcel after Rachel loses him." ## [20] "Rachel and Barry start dating again, despite the fact that he's now engaged to Mindy; Chandler goes nuts when a woman he likes won't return his phone calls." ## [21] "Monica befriends the woman who stole her credit card. Ross is forced to give away Marcel. Joey tries to come up with a less ethnic-sounding stage name." ## [22] "Monica gets a shock when she finds out her boyfriend is a high school student. Chandler finds out his colleagues don't like him when Phoebe temps as his secretary." ## [23] "As Carol goes into labor; Ross and Susan argue, Rachel flirts with Carol's doctor, and Joey assists a pregnant single mother." ## [24] "As Ross leaves for China, Chandler accidentally reveals Ross's feelings for Rachel. Joey takes part in a fertility study and is unable to sleep with his new girlfriend." ## [25] "Rachel waits for Ross at the airport, unaware he has a new girlfriend. Meanwhile, Chandler has a frightening experience with Joey's tailor, and Phoebe gives Monica a bad haircut." ## [26] "Monica goes shopping with Julie and tries to keep it a secret from Rachel. Ross is grossed out by Carol's breast milk. At his day job, Joey competes with a fellow cologne spritzer." ## [27] "Mr. Heckles dies and leaves all his possessions to Monica and Rachel, Chandler worries he will die alone just like him. Meanwhile, Rachel and Monica argue over a lamp, Phoebe and Ross argue over evolution." ## [28] "When the gang find out Phoebe married a gay Canadian ice dancer for a green card, more of their secrets are revealed. Meanwhile, Rachel gives Ross bad advice on his relationship with Julie." ## [29] "The gang are divided by income issues; Monica, Ross and Chandler make more money, while Rachel, Phoebe, and Joey don't. Chandler also uses a case of mistaken identity to his advantage." ## [30] "Joey and Chandler are left to babysit Ben when Monica takes Ross to the hospital. Meanwhile, Phoebe loses her singing gig at Central Perk to a professional singer." ## [31] "A drunken Rachel calls Ross and reveals her feelings for him on his answering machine. Meanwhile, Monica keeps busy by being Chandler's personal trainer and Phoebe constantly wonders why her current boyfriend won't sleep with her." ## [32] "With help from Chandler and Joey, Ross makes a list of pros and cons to decide whether to be with Julie or Rachel. Meanwhile, Monica gets a job making dessert with a disgusting synthetic chocolate substitute." ## [33] "Phoebe tracks down her father, but isn't sure whether she should meet him. Ross asks Rachel to make a list of pros and cons about him." ## [34] "Monica gets back together with 'Fun Bobby' and realizes why he is always so upbeat. Rachel starts dating a guy called Russ who bears an uncanny resemblance to Ross." ## [35] "Rachel's mom comes to visit with big news. Monica caters Carol and Susan's wedding. Phoebe becomes 'possessed' by the spirit of a recently deceased client." ## [36] "Ross goes to visit Marcel whilst on a trip to California and discovers he is working in commercials. Joey receives a fan letter from an attractive but unstable woman. Phoebe is asked to sing for children at a library." ## [37] "Ross finds Marcel on the set of a new movie, where Chandler bumps into a former schoolmate. Meanwhile, Rachel and Monica compete for the affections of Jean-Claude Van Damme." ## [38] "The gang watches a home video from the night of Monica and Rachel's prom. Joey gives Chandler a hideous bracelet." ## [39] "Monica becomes infatuated with a friend of her parents when she caters a party for him. Ross and Rachel go on their first date. Joey and Chandler refuse to move when they get a new TV and two armchairs." ## [40] "Joey and Chandler's friendship is jeopardized when Joey decides to move out. Monica worries about her parents finding out about her relationship with Richard when they attend a party together. Rachel and Phoebe go to get tattoos." ## [41] "Chandler gets a new roommate. Phoebe gets the chance to make a music video for her song \"Smelly Cat\". Ross and Monica clash when he is always at her and Rachel's apartment." ## [42] "Joey's soap opera character is killed off after he brags in an interview that he writes his own lines. Chandler is unnerved by Eddie's strange behavior, while Ross and Rachel compare their past lovers as do Richard and Monica." ## [43] "Chandler demands that Eddie move out; however, he doesn't seem to get the message. Meanwhile, a book on empowerment for women inspires the girls. In order to pay his bills, Ross convinces Joey to audition for a role he doesn't want." ## [44] "Phoebe's world view is shattered when she learns how Old Yeller really ends. Monica becomes jealous when Richard starts hanging out with Chandler and Joey. Rachel panics when she learns that Ross has planned their whole life together." ## [45] "Chandler and Ross run into two bullies at Central Perk. Monica tries her luck at the stock market to avoid taking a job at a 1950s themed diner. Phoebe drives upstate for a second time to meet her father while Joey and Rachel accompany her." ## [46] "Chaos ensues when Rachel's recently divorced parents show up at her surprise birthday party, so the gang has to find ways to keep her parents separated otherwise they'll start fighting." ## [47] "Phoebe catches chicken pox just as an old flame arrives in town on leave from the Navy. Joey gets a job at Chandler's office. Monica is upset that Richard doesn't have any quirks." ## [48] "Rachel reluctantly agrees to be maid of honor at her ex-fiancé Barry's wedding. Monica ponders her future with Richard. Joey has to practice kissing guys to get a role in Warren Beatty's new movie but Ross and Chandler are unwilling to help him." ## [49] "Monica suffers from insomnia and depression following her breakup with Richard. Joey struggles to accept Chandler and Janice's relationship. Ross confides in Rachel about one of his fantasies." ## [50] "A stressed Ross desperately and insistently tries to get the rest of the gang ready for a black tie event at the museum, while Joey and Chandler clash over personal belongings and personal space." ## [51] "Monica tries to get over Richard by using her free time to make jam and considers artificial insemination through a sperm bank. Phoebe is stalked by a man who mistakes her for Ursula." ## [52] "Chandler tries to get over his fear of commitment. Phoebe poses as Joey's agent after she forgets to tell him about an audition. Ross panics after seeing Ben play with a Barbie doll and tries to convince him to play with more manly toys." ## [53] "Phoebe has trouble bonding with her half-brother Frank when he comes to visit. Joey attempts to build an entertainment center. Ross is challenged to name the five celebrities he'd like to sleep with most." ## [54] "The gang remember the events three years ago, when several of them almost slept together." ## [55] "Joey becomes a learning extension teacher in soap acting, and loves the respect from even more clueless kids. Monica chooses a ridiculously cheap bed from Janice's ex; Phoebe signs for her at delivery- of another bed, a childish race car! Rachel convinces Ross to dine with her dad, who takes him down even worse then he feared; the next day Ross and Dr. Green find each-other making fun about Rachel's chiropractor and various lack of good sense. When Joey hears one of his students also auditions for the same role he wants, he tries to eliminate him by bad advice to play..." ## [56] "Chandler is devastated after Joey tells him he saw Janice kissing her ex-husband. Monica accidentally bumps Ben's head into a post when she and Rachel babysit. Phoebe is paranoid if she goes to dentist someone she knows will die." ## [57] "Old sibling rivalry between Monica and Ross resurfaces and postpones Thanksgiving dinner when the gang decide to play a game of \"touch\" football." ## [58] "Ross accidentally breaks a little girl's leg and tries to help her sell boxes of cookies which recreates Monica's childhood fixation. Rachel quits her job at Central Perk and Joey's Christmas tree selling conflicts with Phoebe's principles." ## [59] "A drunken Chandler fools around with one of Joey's sisters - but he can't remember which one. Ross becomes skeptical when a guy at the diner gets Rachel an interview for a position at Bloomingdales." ## [60] "Ross becomes insanely jealous of Mark. Monica hooks up with a co-worker, who writes her a poem with a hidden meaning. One of Joey's numerous lies on his resume is exposed when he takes part in a Broadway production." ## [61] "Monica's willpower is tested when she bumps into Richard. Joey and Rachel exchange their favorite books. Phoebe dates an athletic guy who doesn't realize he has a \"wardrobe malfunction\"." ## [62] "Phoebe is reunited with her former singing partner who thinks \"Smelly Cat\" has hit potential; Chandler dates a woman with a prosthetic leg." ## [63] "Ross seeks solace at a party after a bitter fight with Rachel and ends up in the arms of another woman; Phoebe's date needs an interpreter to communicate." ## [64] "Ross is guilt-ridden after sleeping with Chloe and desperately tries to stop Rachel from finding out and when she does, the rest of the gang listen to them argue and end up trapped in Monica's room for the rest of the night." ## [65] "Monica, Chandler, Phoebe and Joey become stuck in the middle of Ross and Rachel's fight following their break-up." ## [66] "Monica goes out with a guy who turns out to be a software billionaire. Chandler's stop smoking hypnosis tape has an unexpected side effect. Frank makes a surprise announcement that he is getting married - to a woman twice his age." ## [67] "Rachel goes on her first date, after splitting from Ross, with Mark. Joey clashes with his co-star in his new play. Monica continues to date Pete, even though she is still not attracted to him." ## [68] "Monica's aunt dies and leaves her an antique dollhouse that she doesn't want Phoebe to play with; Rachel regrets setting up Chandler with her boss, Joanna." ## [69] "Joey buys a chick for him and Chandler, Pete offers Monica a job at his restaurant but she is undecided if she should accept it. Ross shows his continued feelings for Rachel when he gives up being on TV for her." ## [70] "Ross witnesses Rachel's date screaming at people. Meanwhile, Joey becomes upset when Kate is offered a job in Los Angeles; Phoebe refuses to hang up the phone when she is placed on hold by her phone company." ## [71] "Ross seeks medical help when he finds a mysterious skin condition on his backside. Phoebe struggles to choose between two guys; Monica can't decide what to do about Pete when she thinks he is going to propose." ## [72] "Monica struggles to support Pete in his goal to become the Ultimate Fighting Champion. Chandler is uneasy when his boss playfully slaps his butt. Rachel becomes jealous when Ross starts dating a woman that was introduced to him by Phoebe." ## [73] "While at the beach, Phoebe meets a family friend with links to her past; Ross discovers that Rachel still loves him and must decide between her and Bonnie." ## [74] "Ross chooses between Rachel and his bald-headed girlfriend Bonnie; Joey, Chandler, and Monica have a perilous encounter with a jellyfish at the beach." ## [75] "Phoebe becomes convinced that the spirit of her dead mother is inside a cat. Chandler and Joey are robbed. Monica goes on a date with a guy from her high school." ## [76] "Monica tries to avoid criticism when she caters a party for her mother. Chandler ends up half naked and handcuffed to a chair in Rachel's boss's office. Joey tries to get educated from a salesman trying to sell him a set of encyclopedias." ## [77] "Joey is forced to help Treeger learn how to dance after he threatens to have Monica and Rachel evicted. Phoebe develops a crush on one of her clients. Ross tries to help Chandler quit the gym." ## [78] "Chandler develops feelings for Joey's new girlfriend. Ross and Rachel try to make each other jealous with their dates. Phoebe's cold gives her a sexy singing voice." ## [79] "Ross's new girlfriend is nearly perfect until he discovers her apartment is very dirty. Chandler buys a better birthday present for Kathy than Joey. Phoebe helps Monica cater an event. Rachel is obsessed at finishing a crossword puzzle by herself." ## [80] "Chandler is guilt-ridden after kissing Kathy. Ross starts playing the keyboard again and everyone except Phoebe thinks he's terrible. Joey dates someone else while still attached to Kathy." ## [81] "Chandler tries to earn Joey's forgiveness by lying in a wooden box for six hours. Monica accidentally gets ice in her eye and her doctor turns out to be Richard's son and it's discovered Rachel exchanges the gifts she received in the past." ## [82] "Monica ends up having to choose between a head chef position or the catering business she started with Phoebe. Rachel is close to getting a promotion but tragedy strikes. Chandler and Ross are excited when an old friend is coming to town." ## [83] "In order for her kitchen staff to acknowledge her authority, Monica hires Joey so she can fire him in front of them. Chandler unsuccessfully tries to set Rachel up with a co-worker. Ross can't choose between two girls." ## [84] "Newlyweds Frank and Alice ask Phoebe to be their surrogate. Joey gets a job as a tour guide at Ross's museum. Chandler asks Monica and Rachel for advice on how to sexually satisfy Kathy." ## [85] "Phoebe's uterus is examined for implantation of the embryos. Meanwhile, a seemingly harmless game between Chandler and Joey against Monica and Rachel escalates into a full blown contest where the stakes are raised higher and higher." ## [86] "After seeing Kathy's play, Chandler becomes convinced she is cheating on him with her co-star. Rachel develops a crush on one of her customers. Monica becomes jealous when she realizes she is no longer the 'hostess'." ## [87] "Joey arrives on the set of his latest movie unwashed, after a three-day fishing trip with his dad. Rachel sets up Ross with the niece of her boss. Chandler goes through three phrases to help recover from Kathy cheating on him." ## [88] "Chandler runs into Janice, and finds her more irritating than ever and creates an elaborate plan to break up with her, meanwhile, Ross attempts to learn how to play rugby to impress Emily and Monica obsesses over a electric lighting switch." ## [89] "Rachel organizes a fake good bye party for Emily so she can spend time with Joshua. A side effect from her pregnancy causes Phoebe to have a craving for meat." ## [90] "Chandler and Joey discover that they're getting a free porn channel on their TV. Monica encourages Ross to tell Emily he loves her just before she leaves for London. Phoebe gets a shock when she visits her OB-GYN." ## [91] "Rachel has an awkward encounter with Joshua's parents. Phoebe is offered the chance to name one of the triplets. Ross becomes paranoid when Emily goes to London with Susan." ## [92] "Ross proposes to Emily. Monica and Rachel try to win their apartment back from Chandler and Joey." ## [93] "Monica tries on Emily's wedding dress, and can't stop wearing it. Jealous of Ross's proposal to Emily, Rachel tries to talk Joshua into marriage. Chandler takes Joey to a sleep clinic when he starts snoring." ## [94] "As Ross and Emily send out wedding invitations, he and Rachel each look back on their relationship together while Joey and Chandler look for a purpose in life." ## [95] "at first Ross chooses Joey to be his best man but after a mishap at his bachelor party, he decides he wants both Joey and Chandler as his best men. Phoebe's mood swings makes Monica and Rachel nervous." ## [96] "Phoebe tries to help Rachel deal with her feelings for Ross as the rest of the gang head to London for Ross and Emily's wedding, while someone else unexpectedly shows up to the wedding." ## [97] "Phoebe tries to warn the gang that Rachel is coming to London to tell Ross she still loves him. Ross and Emily's parents get into an argument over the bill for the wedding. Monica and Chandler sleep together. The wedding ends with a gaffe." ## [98] "A humiliated Emily runs away after Ross says Rachel's name at the altar. Meanwhile, Chandler and Monica struggle to get time alone together." ## [99] "Chandler must constantly kiss the girls to cover up a kiss he gave to Monica to hide their affair. Phoebe gets irritated when the gang constantly talk about London. Rachel puts Monica in charge of her love life. Ross tries to contact Emily." ## [100] "The gang take Phoebe to the hospital after she goes into labor. Monica threatens to go on a date with a male nurse after Chandler claims they are \"just goofing around.\" Joey gets treated for kidney stones." ## [101] "Ross finally gets in touch with Emily and they try to work it out. Chandler gloats after Rachel reveals that Monica's secret boyfriend is the best sex she ever had. Phoebe and Joey debate if a selfless good deed exists." ## [102] "Chandler and Monica go away for the weekend but spend the entire time fighting. Ross tries to tell Rachel about his agreement with Emily." ## [103] "The gang become frustrated with Emily's demands to Ross. Monica and Rachel mistake their new neighbor for a yeti. Phoebe receives a fur coat as a family heirloom from her mother." ## [104] "Ross moves in with Chandler and Joey after Emily's cousin kicks him out of his apartment. Phoebe dates a health inspector. Rachel plays hard-to-get with Danny." ## [105] "The gang remember and share with each other their worst Thanksgivings." ## [106] "Joey finds himself constantly covering for Chandler and Monica's affair. Ross becomes angry when someone at work eats his sandwich. Phoebe and Rachel enroll in a literature class." ## [107] "A bored Ross wreaks havoc in Chandler and Joey's lives. Rachel is uncomfortable with Danny's unusually close relationship with his sister. Phoebe runs into trouble whilst collecting donations for the poor during Christmas." ## [108] "The gang make their New Years resolutions. Chandler struggles to not make jokes about everyone. Rachel uncovers a secret. Ross runs into trouble when he wears leather pants on a date." ## [109] "Monica becomes annoyed at how Chandler sucks up to his boss by mimicking his boss's laugh and laughing at his tasteless jokes. Ross hooks up with Janice when he finds out Emily is getting married." ## [110] "Phoebe's grandmother dies, and Phoebe is shocked when her father turns up at the funeral. Meanwhile, Rachel gives Joey a \"man's bag\" for an audition, and Chandler is scared to tell Monica he doesn't like her massages." ## [111] "When Phoebe finds out about Monica and Chandler, she and Rachel attempt to get them to confess their relationship." ## [112] "Ross makes enemies out of his new neighbors. Chandler freaks out about his relationship with Monica. Joey dates a girl who likes to playfully punch him but she doesn't realize she punches him too hard and Joey is reluctant to tell her." ## [113] "Joey has a dream about Monica and becomes convinced he is in love with her. Meanwhile, Phoebe finds a police badge in Central Perk, and Ross tries to get his new sofa into his apartment." ## [114] "Rachel has an awkward encounter when she interviews for a new job. Monica becomes jealous of Phoebe and Gary. Joey searches for a 'hot girl' in Ross's building." ## [115] "Rachel takes up smoking to feel more included at work. Joey auditions for a soup commercial with Ross's son Ben, but they end up competing against each other. Monica and Phoebe plan Rachel's surprise birthday party one month in advance." ## [116] "As Joey's grandmother visits to watch him on TV, Ross has trouble flirting with the pizza delivery girl, and Rachel tries to find an earring of Monica's that she has misplaced." ## [117] "The guys go on a ride-along with Gary. Rachel accidentally deletes a message from Emily on Ross's answering machine." ## [118] "Gary asks Phoebe to move in with him but she's reluctant to and to overcome boredom, Ross and Joey start throwing a ball to each other. Rachel buys an expensive cat but it doesn't behave as she hoped it would." ## [119] "Joey drives to Las Vegas to shoot to shoot a new movie where he is in the lead role. Rachel gets an eye infection but is reluctant to seek treatment because of her eye phobia. Phoebe is mad at Ross, but doesn't know why." ## [120] "The gang go to Las Vegas to visit Joey. Chandler is angry when he finds out Monica had lunch with Richard. Ross and Rachel try to embarrass each other after an awkward encounter." ## [121] "Chandler and Monica reconcile and hastily decide to get married. Ross and Rachel get drunk and roam the casino. Phoebe deals with a 'lurker' on the slot machines." ## [122] "Ross and Rachel deal with the aftermath of their drunken escapade. Phoebe and Joey take a road trip back to New York in Phoebe's grandmother's cab. Monica and Chandler ponder the idea of marriage." ## [123] "Monica and Chandler try to tell Rachel and Joey that they're moving in together. Phoebe thinks that Ross didn't get the annulment because he still loves Rachel." ## [124] "Ross tries to deny he still has feelings for Rachel. Joey interviews for a new roommate. Monica and Chandler argue over what to do with the spare room when they move in together." ## [125] "Joey's health benefits lapse just as he develops a hernia. Ross is given a professorship at NYU and eager to impress his students, he puts on a fake English accent." ## [126] "Ross and Rachel try to get an annulment, Joey finds the keys to a porsche in Central Perk, and Phoebe, Monica and Chandler babysit the triplets." ## [127] "On the last night before Chandler and Monica move in together, Monica and Rachel argue, and Chandler tries to give Joey money to help him pay the bills." ## [128] "Rachel is embarrassed by Phoebe's odd running style. Joey gets a new roommate. Chandler tries to impress Monica by cleaning the apartment but forgets how everything is supposed to look." ## [129] "Ross goes too far while trying to impress a date by over-whitening his teeth. Rachel uses gossip to get her boss to like her after Phoebe supposedly makes out with Ralph Lauren." ## [130] "Ross is forced to reveal the reason why Jack and Judy don't like Chandler. Rachel tries to make dessert for the gang. Joey and Ross try to get out of Thanksgiving when they are invited to hang out with Janine and her dancer friends." ## [131] "On the set of \"Dick Clark's New Year's Rockin' Eve\", Joey tries to kiss Janine at midnight and Monica and Ross resurrect their dance routine from high school. Meanwhile, Rachel, Phoebe and Chandler look for Monica's Christmas presents." ## [132] "Joey is caught in the middle when Janine tells him she doesn't like Monica and Chandler. Meanwhile, Rachel buys an apothecary table from a store that Phoebe hates." ## [133] "Chandler and Ross argue over a joke. Meanwhile, Joey reluctantly takes a waiter job at Central Perk, and Monica becomes annoyed when Phoebe says she would choose Rachel over her as a girlfriend." ## [134] "Rachel's younger sister arrives in New York and goes on a date with Ross. Meanwhile, Monica won't admit that she is sick." ## [135] "Rachel tries to end the spark between Ross and Jill. When Chandler admits that he can't cry, Monica tries to make it happen. The gang discovers that Phoebe's sister, Ursula, is a porn star and is using Phoebe's name." ## [136] "When Rachel hears Barry and Mindy are getting divorced, the gang wonder how different their lives could have been." ## [137] "The gang continue to think about how different their lives could have been." ## [138] "Rachel and Phoebe take self-defense classes. Chandler and Monica agree to give each other homemade presents for Valentine's Day. Joey tries to get money through medical research." ## [139] "Ross jeopardizes his career when he starts dating a student from one of his palaeontology classes. Rachel and Phoebe's apartment catches fire." ## [140] "Joey tries to get everyone to pay for his broken fridge. Ross becomes paranoid when Elizabeth makes plans for spring break. Monica and Chandler compete against Phoebe to find Rachel a date." ## [141] "Chandler forgets to write down a message for Joey when the time of his audition for the lead in a TV show is changed." ## [142] "Elizabeth's father takes an instant disliking to Ross. Joey almost gets fired from \"Mac and C.H.E.E.S.E.\" after offending the operator of the robot. Phoebe writes a book based on Monica and Chandler." ## [143] "Paul threatens to have Ross fired from the university if he continues to date Elizabeth. The girls put their names down on a waiting list for a wedding venue." ## [144] "Chandler and Phoebe go looking for an engagement ring for Monica. Rachel tries to get Paul to open up to her." ## [145] "Chandler's plan to propose to Monica at dinner is interrupted by Richard. Joey accidentally buys a boat at a silent auction. Ross and Elizabeth's relationship comes to a crossroad." ## [146] "Chandler continues to pretend to hate the idea of marriage, unaware Richard wants Monica back. Meanwhile, Rachel and Phoebe discuss their 'back-up' plans." ## [147] "The gang celebrate Monica and Chandler's engagement, however Ross and Rachel upstage them by briefly reuniting. Joey tries to dress and act like a nineteen-year-old for an audition." ## [148] "Monica learns her parents have spent her entire wedding fund. Phoebe temporarily moves into Ross's apartment, bringing her massage clients with her. Joey mocks Rachel when he finds an erotic novel she is reading." ## [149] "Monica tries to figure out Phoebe's grandmother's secret cookie recipe. Meanwhile, Rachel tries to teach Joey how to sail, and Chandler has an awkward encounter when he tries to bond with Jack." ## [150] "Chaos ensues when Monica and Chandler decide to share each other's secrets. Rachel gets a promotion and interviews for an assistant. Joey is offered the chance to go back on \"Days of Our Lives\"." ## [151] "Chandler struggles to photograph well for his and Monica's engagement picture. Joey teaches Tag how to pick up women, much to Rachel's annoyance. Phoebe and Ross date a couple who are divorcing." ## [152] "Joey and Ross accidentally take a nap together - and much to their dismay, find that they like it. Phoebe and Rachel compete to become Monica's maid of honor." ## [153] "Ross and Chandler discovers that Ross's book is in the section of the library where students go to have sex. Monica and Chandler run into Janice and she immediately invites herself to the wedding. They try to avoid her. Meanwhile, Rachel and Phoebe befriend Joey's girlfriend." ## [154] "Ross struggles to name all 50 states in a game. Joey compromises Rachel's chances with her crush, Tag, during Thanksgiving dinner. Phoebe sneaks a dog into the apartment, making Chandler extremely nervous." ## [155] "Monica makes candy to get to know her neighbours, Rachel and Tag try to hide their relationship at work and Ross buys Phoebe a bike." ## [156] "Ross wants to introduce Ben to Hanukkah. In order to entice Rachel to move back into their refurbished apartment, Phoebe must drive a wedge between Rachel and current roomie Joey." ## [157] "Chandler refuses to give back a cheesecake accidentally delivered to his apartment; Phoebe gets angry with Joey when he blows off dinner with her for a date." ## [158] "After the gang head up to the roof to see a passing comet, separate events unfold that lead to them all having a sleepless night." ## [159] "Rachel breaks Joey's armchair. Phoebe takes a temp job in a call centre. Ross and Monica find out their parents are selling their childhood home." ## [160] "Rachel's 30th birthday prompts the rest of the gang to reminisce about their own 30th celebrations." ## [161] "Joey gets an opportunity to rejoin \"Days of Our Lives\" when his comatose character is implanted with the brain of a female character. Joey approaches her to get some advice on how to play her character, but she's unaware that she's being written out of the show and freaks out at Joey. Later, she tries to give him some pointers, and they end up spending the night together. Ross tells Chandler and Monica that he has a surprise for their wedding, which turns out to be him playing the bagpipes - terribly, as it turns out. Rachel and Phoebe have their eye on a guy at the ..." ## [162] "Chandler is shocked to find out who Monica really wanted to sleep with the night they first got together. Meanwhile, Rachel gets into trouble with Ross when she teaches Ben practical jokes." ## [163] "Monica takes the other girls to an overpriced store to choose her wedding dress, briefing them as if they were in the military since bargain-hunters are far more ruthless then Rachel can usually handle. The worst shopper is Megan: she grabs the dress Monica wants, then blackmails her over booking the swing band that's the only thing Chandler really wants for the wedding. Meanwhile, Ross and Joey independently meet and date Kristen while helping her move in. The rivals agree to let her choose after one date with each, but they get so carried away cheating on the deal ..." ## [164] "Joey is nominated for a Soapy Award for his part on Days of Our Lives and Rachel is his date to the ceremony. Joey doesn't win the award but takes someone else's award home. Rachel convinces him to take it back because he can't be happy with an award he didn't win. One of Ross' students failed the midterms because he is in love with Ross and can't concentrate in class so Ross changes his grade. But now more students come to Ross pretending to be in love with him in order to get a better grade. When Rachel and Joey take the Soapy back the real winner just throws it ..." ## [165] "Joey auditions for a naked role in a big movie; Rachel and Phoebe plan Monica's wedding shower; Ross becomes attracted to his cousin after she visits." ## [166] "Rachel's college friend can't remember a scandalous kiss from the past; Chandler and Ross argue for possession of Val Kilmer's tuxedo." ## [167] "Monica and Chandler are getting married in four weeks and have to write their vows, but neither has a clue what to say, so they reflect on their past." ## [168] "Ross and Rachel hit the freeway together when Monica's Porsche shows up again; Chandler and Monica go off to Vegas to find Chandler's estranged dad." ## [169] "So close to the wedding, Chandler suddenly realizes the overwhelming meaning of getting married. Meanwhile, Joey acts opposite a famous actor in a movie, but can't bring himself to tell him that he spits when he says his lines." ## [170] "Ross tries to find Chandler with Phoebe's help. Meanwhile Rachel tries to hinder Monica." ## [171] "The gang learns that Rachel is pregnant; Joey tries to impress a Broadway director who's dating Chandler's mom; Chandler's shoes make it hard for him to dance." ## [172] "Monica, Phoebe and Joey advise Rachel to tell the father about the pregnancy. Chandler and Ross lose the wedding photos." ## [173] "Even on their honeymoon, Monica is pushy, and is annoyed that Chandler won't jump the line at the airport check-in - especially after the couple in front of them, also on their honeymoon, get bumped up to first class. They try to sneak into the first-class lounge, but are caught - but she at least manages to steal an orange. Joey and Phoebe find that Monica and Chandler have tricked them out of the keys to the master apartment; Joey hopes a false gas leak alert will make super Treeger use his key, but he makes a fireman use an axe, and the wrecked door calls for a big..." ## [174] "Ross and Rachel tell everyone about the night they were together. They have two different stories of how it happened until Ross accidentally reveals that he videotaped it. Not surprisingly, everyone wants to see it." ## [175] "Phoebe dates Monica's sous-chef Tim and Monica doesn't fire him for Phoebe's sake. When Phoebe decides to dump Tim, Monica can finally fire him. Rachel has a date with Kash, a co-star on Days of Our Lives. Ross thinks it's weird because whoever takes Rachel out, takes his baby out too. He always pictured that his next child would grow up in a happy family. Rachel's date was terrible because she made the mistake of mentioning she was pregnant. Ross reassures her it isn't so bad because when she has the baby she will love someone more than she ever loved anyone." ## [176] "Monica and Chandler decide to throw a Halloween party; Phoebe runs into Ursula and her fiancée, who knows nothing about the \"real\" Ursula." ## [177] "Chandler hires a maid, whom Monica suspects is stealing her clothing; Eric has trouble forgetting Ursula when he breaks up with her to date Phoebe." ## [178] "Chandler finds out that Monica had a bachelorette party with a stripper, even though they promised not to have bachelor/bachelorette parties. Rachel takes Phoebe along to dinner with Rachel's dad, because she is afraid her dad will be really angry when she tells him she's pregnant. Mr. Green is delighted to hear he will be a grandfather, but freaks out when he finds out that Rachel isn't getting married - so she just tells him that Ross won't marry her. Monica feels bad about having had a bachelorette party, so she organizes a bachelor party including a stripper for ..." ## [179] "Monica invites Will, an old school friend of her and Ross over for Thanksgiving dinner, unaware he isn't too fond of Rachel." ## [180] "Monica's expensive new boots hurt her feet, but she's determined to prove to Chandler that her purchase was worth it; Ben goes to school with Sting's son." ## [181] "Joey wants to take Rachel to dinner on a pretend date to practice his dating skills, but soon develops romantic feelings for her; Monica, Phoebe, and Chandler are addicted to Mrs. Pacman." ## [182] "Joey wants to take Rachel to dinner on a pretend date to practice his dating skills, but soon develops romantic feelings for her; gang addicted to Mrs. Pacman." ## [183] "Monica turns Chandler on to the concept of taking a bath to relax; Ross and Rachel toss baby names around while deciding whether to learn the baby's sex." ## [184] "Chandler's very curious about a locked closet, but Monica won't tell him what is inside." ## [185] "During Valentine's Day, Chandler discovers the miracle of birth seeing an extremely graphic video." ## [186] "Ross freaks out when Joey tells him that he is in love with Rachel because Ross is afraid that they will get married and raise his kid together. Phoebe dates a guy called Don, who she thinks is Monica's soul-mate and introduces Don to Monica to see what will happen. Monica and Don get along perfectly. Ross goes to tell Joey that he doesn't hate him and Joey promises to never act on his feelings for Rachel because he won't jeopardize his friendship to Ross. But when Ross realizes that Joey really is in love for the first time he tells Joey to tell Rachel. When Joey ..." ## [187] "Chandler and Monica are happy together - their worst problem is his habit to put CDs in the wrong box and their different taste in music. Rachel is desperate to get back on good terms with Joey, so she takes Monica's advice to change the subject to something work-related. However in another uncomfortable conversation she manages to convince Joey that her boss, Mr. Zelner, wants to buy her baby. When Phoebe resumes reading tea leaves, she sees that she'll meet the man of her dreams soon, and takes that to be Jim, who she keeps bumping into. However she soon finds he ..." ## [188] "Everyone prepares for the Gellers' 35th wedding anniversary in Long Island; Monica struggles to prepare the perfect toast; Phoebe invites her new boyfriend Parker." ## [189] "Joey prepares for his epic interview with Soap Opera Digest, reminiscing about his past acting experiences, his friends and his romantic life." ## [190] "Monica and Phoebe throw Rachel a baby shower but forget to invite Rachel's mom. Rachel realizes she has no idea how to look after the baby after the birth. Meanwhile, Joey auditions for a job as a host for a new game show called \"Bamboozled\", and Chandler and Ross help him practice." ## [191] "Monica's restaurant get a bad review. After confronting the critic who wrote it, she decides to join a cooking class, with Joey in tow. Rachel gets jealous when Ross hits it off with a woman at the baby department store." ## [192] "Monica and Phoebe bet on when Rachel's baby will be born as the due date comes and goes as Rachel becomes extremely irritable; Chandler falls asleep at Joey's big movie premiere." ## [193] "Ross and Rachel go to the hospital to have their baby, but it's a long labor. They get stuck in a semi-private room, and many other couples come and go before Rachel is ready to deliver - the last couple being Janice and her new husband. Chandler and Monica decide to start trying to have a baby." ## [194] "After Rachel gives birth to her baby, she must confront relationship issues around her." ## [195] "Rachel, Ross and Joey get together in a guyand figure out that no one was actually going to propose; Mr. Geller walks in on Monica and Chandler having sex." ## [196] "Chandler, having trouble getting enough sleep at home, falls asleep in a meeting and accidentally agrees to run his company's Tulsa office." ## [197] "Joey arranges a blind date for Phoebe. Chandler is leaving for Tulsa without Monica, because she has got a great job offer." ## [198] "Monica thinks Chandler is aroused by shark documentaries." ## [199] "Phoebe will celebrate her birthday by having a dinner with her friends at a fancy restaurant. But everybody is late to the dinner, due to a series of problems." ## [200] "Looking for a new nanny, Ross and Rachel hire a male nanny named Sandy. Monica tells Chandler that a guy at work is the funniest guy she has ever met." ## [201] "Ross finds a way to make Emma laugh - singing \"Baby Got Back.\" Meanwhile, Phoebe meets Mike's parents, and Joey and Chandler find a video tape in Richard's apartment." ## [202] "Rachel's middle sister shows up at Thanksgiving and causes arguments amongst the gang." ## [203] "Rachel is ready to start hanging out again. She and Phoebe go to a bar, where they meet two guys." ## [204] "Chandler must spend Christmas in Tulsa, which Monica thinks he might have an affair with a former Miss Oklahoma runner-up while he is there. Chandler comes home early to announce that he quit his job." ## [205] "Chandler starts looking for a job and is anxious about having a baby, Rachel decides to go back to work, and Phoebe works as an extra on Joey's show." ## [206] "Ross makes Joey stay away from their new nanny. Mike accidentally kills Phoebe's rat. Gavin gives Rachel a scarf and a kiss for her birthday." ## [207] "A night at Mike's piano bar gives Monica a very showy moment in the spotlight; Chandler employs his secret skill to repair Joey's botched eyebrow-waxing job." ## [208] "Phoebe and Joey purposely set Ross and Rachel up on bad dates in the hopes they'll get back together. Monica and Chandler babysit Emma." ## [209] "Joey gets a part in a stage-play in a painful way. Ross and Phoebe are mugged outside Central Perk, Phoebe realizes that she mugged Ross 18 years ago. Chandler starts his new career as advertising writer." ## [210] "When Monica and Chandler both ask Joey for money not wanting the other to know why they are asking for it, Chandler sees that Joey gave money to Monica. Joey makes up that Monica is getting a boob job. Phoebe asks Mike to move in with her, but decides not to when she and Mike argue about their future. Rachel attempts to baby-proof the apartment, but makes Joey go insane when he can't open anything." ## [211] "When Chandler and Ross joke around on their college website, Ross is accused of being dead which leads to the fact that he was not popular in college. Joey is not willing to give his favorite stuffed animal, Hugsy, to Emma. Monica helps Phoebe not call Mike." ## [212] "Hoping to win a huge jackpot, the friends pool their money and buy dozens of lottery tickets. However, they bicker over how to spend the fortune if they win, and Monica irritates everyone else by buying tickets just for her and Chandler." ## [213] "Joey is insecure now his Days of Our Lives character Dr. Drake Ramore is getting real dialog, so he asks Rachel to come along to the set, which she loves enough to get romantic dreams, but about Drake, Joey or both? Monica's fancy restaurant Javu is doing great, so she's flat out, too badly to accept joining Chandler on a surprise trip he booked to Vermont. When Phoebe comes sing her gross songs outside Javu, Monica tries to tell her nicely it's inappropriate, lacking style, but Phoebe just gets fancier dress; once told the truth, she starts a nasty row... Meanwhile ..." ## [214] "Joey throws a cast party on the roof of his building where he ends up making out with an attractive professor that Ross had a crush on." ## [215] "Still unable to conceive, Monica and Chandler decide to get tests done at a fertility clinic, where they run into Chandler's favorite ex, Janice. Rachel receives a gift certificate for a free massage at a chain massage center. Phoebe chastises Rachel for even thinking about going to a massage chain, which she feels takes away business from independent massage therapists like herself; however, Phoebe actually works at this specific massage chain. Rachel says she won't go and even tears up the gift certificate, but she later tapes it back together, goes for her free ..." ## [216] "When Joey hears that his girlfriend Charlie is an insecure shopper, he volunteers expert Rachel, who dreads being alone with her, so she makes sure Phoebe comes along, by saying she needs a dazzling outfit for the party she's going to just to save face as her ex Mike is coming too. Gynecologist Dr. Connelly tells Chandler and Monica they should keep trying the natural way, but realistically consider a surrogate mother -a nightmare for Monica- or donor sperm insemination, so Chandler invites his 'perfectly eligible' colleague Zach for dinner; they scare him with ..." ## [217] "Chandler gives advice to David, but that makes David want to propose to Phoebe. Although Phoebe is still in love with Mike. Monica calls Mike who shows up there right in the middle of David's proposal. Mike proposes instead. Phoebe gets back together with Mike, but doesn't accept his proposal. Monica's hair gets all poofy after getting off the plane. Charlie and Ross enjoy themselves when rewriting Ross's speech. Rachel keeps changing her mind on when to tell Joey that she has feelings for him." ## [218] "To the other friends' fury, it keeps raining except during Ross's speech, which to their amazement is a big hit with the paleontologists. Joey's scientific ignorance decides Charlie to turn her favor to Ross, then they must flee the other academics who intend by tradition to throw the key note-speaker into the pool. Chandler and Phoebe knew better, but Mike accepts to play table tennis against ever-obsessive fluffy monster Monica; when she gets injured, Chandler jumps in and crushes Mike. Rachel can't hide her feelings for Joey anymore, so when he sees Ross and ..." ## [219] "Joey and Ross both attempt to come clean to each other that they're dating Rachel and Charlie. Phoebe finds out Mike has another girlfriend." ## [220] "Rachel and Joey fear for Ross's state of mind after he finds out about their relationship. Chandler and Monica visit some friends of Phoebe to get advice on adoption. Frank and the triplets come to visit." ## [221] "Ross goes to a tanning salon but fails to follow the 'simple' instructions. Joey and Rachel struggle to make the transition from friends to lovers. Monica and Phoebe try to avoid an annoying woman that used to live in their building." ## [222] "On Emma's first birthday, Ross and Rachel convince everyone to delay their plans so they can attend her party, however plans go awry when Emma's birthday cake is revealed." ## [223] "Rachel's sister Amy comes to visit and moves in with her and Joey. Phoebe constantly and accidentally ruins Mike's proposals. Joey struggles to write a letter of recommendation for Monica and Chandler's adoption agency." ## [224] "Ross applies for a paleontology grant and finds out Charlie's ex-boyfriend reviews the applications. Monica and Rachel fight over who has to take Phoebe's ugly painting." ## [225] "Monica and Chandler nervously prepare for a visit from an adoption worker. Phoebe and Mike keep changing their minds about donating their wedding money to charity. Ross fights Rachel's fear of swings." ## [226] "Joey, Ross, Rachel and Phoebe convince Monica and Chandler to host Thanksgiving, however the four of them end up arriving to dinner an hour late." ## [227] "After Rachel confirms Joey is more mature in relationships, Phoebe presents him to another friend as date, Sarah, who fails alas to respect his primordial rule by touching food in his plate. Ross wants fashion advice for his date, so Rachel and Phoebe take him shopping, but after he left the choosing to professional buyer Rachel he accidentally ends up wearing her stuff, despite Joey's 'jealous' warning. Monica let the gang get her hopes up when Chandler and she fly to on adoption agency in Ohio. The pregnant mother, Erica, likes them- but only because their files got..." ## [228] "Chandler and Monica have decided they want to raise their offspring in a suburban house and even find a perfect one in Westchester. Rachel and Phoebe see Chandler enter a car with his realtor, Nancy, and think he's cheating on Monica. After that misunderstanding is cleared, the other Friends are shocked the couple wants to leave Manhattan, and everybody starts reminiscing about living in New York as a gang, until Nancy calls about their bid on the house." ## [229] "Old secrets come to light when Ross and Chandler attend a college reunion. Monica and Rachel throw Phoebe a bachelorette party. Joey appears as a celebrity partner on a game show." ## [230] "Chaos ensues as Phoebe and Mike prepare to get married." ## [231] "Phoebe tries to teach Joey to speak French for an audition; Ross and Rachel head out to Long Island after her dad has a heart attack." ## [232] "When Phoebe goes to get her name changed she realizes she can change it to anything she wants, so she changes it to Princess Consuela Banana Hammock, to Mike's displeasure. Chandler finds out that Monica never changed her last name. Monica and Chandler take Joey to their house to convince him it is a good move and he tries to find anything wrong with the house so they won't buy it. Rachel goes to a job interview at a restaurant but her current boss is sitting right beyond her, costing her her job at Ralph Lauren. When cleaning out her office, she bumps into Mark who ..." ## [233] "Ross tries to get Rachel to go back to Ralph Lauren, Joey doesn't know that his agent has died, and Monica and Chandler bump into Janice." ## [234] "The gang throws Rachel a goodbye party, during which she says goodbye to everybody individually." ## [235] "Phoebe races Ross to the airport in a bid to stop Rachel from leaving for Paris. Monica and Chandler pack up their apartment ahead of their move to their new house, and Joey buys Chandler a new chick and duck as a leaving present." ``` --- ```r friends$description[1] ``` ``` ## [1] "Monica and the gang introduce Rachel to the \"real world\" after she leaves her fiancé at the altar." ``` -- ```r first_episode_desc <- friends$description[1] ``` --- <img src="img/stringr-logo.png" width="40%" style="display: block; margin: auto;" /> --- class: middle ```r str_something(some_character_vector, ....) ``` --- class: inverse middle .font75[str_length()] --- ```r str_length(first_episode_desc) ``` ``` ## [1] 98 ``` `str_length()` returns the length of string. --- Which episode has the longest description? ```r str_length(friends$description) ``` ``` ## [1] 98 151 181 197 220 210 141 109 101 172 153 191 177 216 167 161 136 82 ## [19] 76 156 151 163 125 168 178 180 205 189 184 163 230 208 134 164 155 217 ## [37] 173 113 202 229 172 226 232 234 240 185 179 245 192 195 183 237 204 89 ## [55] 577 229 145 240 198 215 186 139 154 224 113 230 193 155 211 207 209 238 ## [73] 155 150 161 238 192 164 247 188 239 238 218 186 232 216 226 240 158 213 ## [91] 172 97 207 159 201 185 239 140 240 205 219 137 178 159 70 179 222 183 ## [109] 196 217 114 235 186 160 236 176 116 209 220 178 162 196 160 178 164 144 ## [127] 152 185 177 232 235 163 194 121 216 114 75 178 142 189 117 199 158 109 ## [145] 180 154 181 212 193 194 194 158 276 205 132 179 157 129 145 99 576 189 ## [163] 576 574 150 134 150 148 227 88 159 120 577 215 566 138 147 576 124 154 ## [181] 187 159 153 88 98 574 575 163 142 283 220 178 296 87 155 139 123 57 ## [199] 159 150 166 86 97 200 149 141 157 135 204 401 258 237 576 135 574 571 ## [217] 499 571 140 204 233 171 219 169 200 145 577 458 179 55 133 576 137 96 ## [235] 230 ``` --- Which episode has the longest description? ```r max(str_length(friends$description)) ``` ``` ## [1] 577 ``` --- Which episode has the longest description? ```r friends %>% filter(str_length(description) == max(str_length(description))) ``` ``` ## # A tibble: 3 x 5 ## season episode title description rating ## <dbl> <dbl> <chr> <chr> <dbl> ## 1 3 7 The One with th… Joey becomes a learning extension teac… 8.3 ## 2 8 3 The One Where R… Even on their honeymoon, Monica is pus… 8.7 ## 3 10 9 The One with th… After Rachel confirms Joey is more mat… 8.6 ``` --- Which episode has the longest description? ```r friends %>% filter(str_length(description) == max(str_length(description))) %>% select(description) %>% pull() %>% str_length() ``` ``` ## [1] 577 577 577 ``` --- class: inverse middle .font75[str_sub()] --- ```r first_episode_desc ``` ``` ## [1] "Monica and the gang introduce Rachel to the \"real world\" after she leaves her fiancé at the altar." ``` -- ```r # 2nd to 8th character str_sub(first_episode_desc, 2, 8) ``` ``` ## [1] "onica a" ``` -- ```r # 4th to fifth-to-last character str_sub(first_episode_desc, 4, -5) ``` ``` ## [1] "ica and the gang introduce Rachel to the \"real world\" after she leaves her fiancé at the al" ``` --- class: middle inverse .font75[str_to_lower()] .font75[str_to_upper()] --- ```r str_to_lower(first_episode_desc) ``` ``` ## [1] "monica and the gang introduce rachel to the \"real world\" after she leaves her fiancé at the altar." ``` -- ```r str_to_upper(first_episode_desc) ``` ``` ## [1] "MONICA AND THE GANG INTRODUCE RACHEL TO THE \"REAL WORLD\" AFTER SHE LEAVES HER FIANCÉ AT THE ALTAR." ``` --- Change all the titles to capital letters. ```r friends %>% mutate(title = str_to_upper(title)) ``` ``` ## # A tibble: 235 x 5 ## season episode title description rating ## <dbl> <dbl> <chr> <chr> <dbl> ## 1 1 1 THE ONE WHERE MONIC… "Monica and the gang introduce Ra… 8.3 ## 2 1 2 THE ONE WITH THE SO… "Ross finds out his ex-wife is pr… 8 ## 3 1 3 THE ONE WITH THE TH… "Monica becomes irritated when ev… 8.2 ## 4 1 4 THE ONE WITH GEORGE… "Joey and Chandler take Ross to a… 8.1 ## 5 1 5 THE ONE WITH THE EA… "Eager to spend time with Rachel,… 8.5 ## 6 1 6 THE ONE WITH THE BU… "Monica's obsessiveness is put to… 8.1 ## 7 1 7 THE ONE WITH THE BL… "When New York suffers from a bla… 9 ## 8 1 8 THE ONE WHERE NANA … "Monica and Ross mourn the loss o… 8.1 ## 9 1 9 THE ONE WHERE UNDER… "The gang's plans for Thanksgivin… 8.2 ## 10 1 10 THE ONE WITH THE MO… "The gang make (and break) a pact… 8.1 ## # … with 225 more rows ``` --- class: middle inverse .font75[str_detect()] --- ```r str_detect(first_episode_desc, "Rachel") ``` ``` ## [1] TRUE ``` -- ```r str_detect(first_episode_desc, "Ross") ``` ``` ## [1] FALSE ``` --- How many episodes have "Phoebe" in the description? ```r str_detect(friends$description, "Phoebe") ``` ``` ## [1] FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE ## [13] TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE ## [25] TRUE FALSE TRUE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE ## [37] FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE TRUE FALSE TRUE FALSE ## [49] FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE ## [61] TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE TRUE TRUE ## [73] TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE ## [85] TRUE FALSE FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE ## [97] TRUE FALSE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE TRUE FALSE ## [109] FALSE TRUE TRUE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE FALSE ## [121] TRUE TRUE TRUE FALSE FALSE TRUE FALSE TRUE TRUE FALSE TRUE TRUE ## [133] TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE ## [145] FALSE TRUE FALSE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE ## [157] TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE ## [169] FALSE TRUE FALSE TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE FALSE ## [181] TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE ## [193] FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE ## [205] TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE ## [217] TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE ## [229] TRUE TRUE TRUE TRUE FALSE FALSE TRUE ``` --- ```r str_detect(friends$description, "Phoebe") %>% sum() ``` ``` ## [1] 135 ``` --- class: inverse middle .font75[str_split()] --- ```r str_split(first_episode_desc, boundary("word")) ``` ``` ## [[1]] ## [1] "Monica" "and" "the" "gang" "introduce" "Rachel" ## [7] "to" "the" "real" "world" "after" "she" ## [13] "leaves" "her" "fiancé" "at" "the" "altar" ``` --- ```r str_split(first_episode_desc, boundary("character")) ``` ``` ## [[1]] ## [1] "M" "o" "n" "i" "c" "a" " " "a" "n" "d" " " "t" "h" "e" " " ## [16] "g" "a" "n" "g" " " "i" "n" "t" "r" "o" "d" "u" "c" "e" " " ## [31] "R" "a" "c" "h" "e" "l" " " "t" "o" " " "t" "h" "e" " " "\"" ## [46] "r" "e" "a" "l" " " "w" "o" "r" "l" "d" "\"" " " "a" "f" "t" ## [61] "e" "r" " " "s" "h" "e" " " "l" "e" "a" "v" "e" "s" " " "h" ## [76] "e" "r" " " "f" "i" "a" "n" "c" "é" " " "a" "t" " " "t" "h" ## [91] "e" " " "a" "l" "t" "a" "r" "." ``` --- class: inverse middle .font75[str_replace()] --- ```r str_replace(first_episode_desc, "Monica", "Monika") ``` ``` ## [1] "Monika and the gang introduce Rachel to the \"real world\" after she leaves her fiancé at the altar." ``` --- class: center middle [stringr cheatsheet](https://github.com/rstudio/cheatsheets/raw/master/strings.pdf)