Import your data

scooby <- read_excel("../00_data/MyData.xlsx")

Chapter 14

Tools

Detect matches

scooby$monster_gender
##   [1] "Male"                                                                                                  
##   [2] "Male"                                                                                                  
##   [3] "Male"                                                                                                  
##   [4] "Male"                                                                                                  
##   [5] "Female"                                                                                                
##   [6] "Male"                                                                                                  
##   [7] "Male"                                                                                                  
##   [8] "Male"                                                                                                  
##   [9] "Male"                                                                                                  
##  [10] "Male"                                                                                                  
##  [11] "Male,Male,Male"                                                                                        
##  [12] "Male"                                                                                                  
##  [13] "Male,Female"                                                                                           
##  [14] "Male"                                                                                                  
##  [15] "Male"                                                                                                  
##  [16] "Male,Male"                                                                                             
##  [17] "Male"                                                                                                  
##  [18] "Male"                                                                                                  
##  [19] "Male,Male,Male"                                                                                        
##  [20] "Male"                                                                                                  
##  [21] "Male"                                                                                                  
##  [22] "Male"                                                                                                  
##  [23] "Female,Male"                                                                                           
##  [24] "Male"                                                                                                  
##  [25] "Male"                                                                                                  
##  [26] "Male,Male,Male,Male,None"                                                                              
##  [27] "Male,Male"                                                                                             
##  [28] "Female"                                                                                                
##  [29] "Male"                                                                                                  
##  [30] "Male,Male"                                                                                             
##  [31] "Male,Male,Male"                                                                                        
##  [32] "Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                          
##  [33] "Male,Male"                                                                                             
##  [34] "Male,Female,Male,Male,Male,Male,Male"                                                                  
##  [35] "Male"                                                                                                  
##  [36] "Male"                                                                                                  
##  [37] "Male,Male,Male,Male"                                                                                   
##  [38] "Male,Male"                                                                                             
##  [39] "Male,Male"                                                                                             
##  [40] "Male,Male"                                                                                             
##  [41] "Male,Male,Male,Male"                                                                                   
##  [42] "Male,Male,Male"                                                                                        
##  [43] "Male,Male"                                                                                             
##  [44] "Male"                                                                                                  
##  [45] "Male"                                                                                                  
##  [46] "Male,Male,Male,Male,Male,Male,Male,Male"                                                               
##  [47] "Male,Male,Male,Male"                                                                                   
##  [48] "Male,Male"                                                                                             
##  [49] "Male"                                                                                                  
##  [50] "Male,Female"                                                                                           
##  [51] "Male,Male"                                                                                             
##  [52] "Male,Male"                                                                                             
##  [53] "Male,Male,Male"                                                                                        
##  [54] "Male"                                                                                                  
##  [55] "Male"                                                                                                  
##  [56] "Male"                                                                                                  
##  [57] "Male,Male"                                                                                             
##  [58] "Male"                                                                                                  
##  [59] "Male,Male"                                                                                             
##  [60] "Male,Female,Male"                                                                                      
##  [61] "Male"                                                                                                  
##  [62] "Male"                                                                                                  
##  [63] "Male,Male,Male"                                                                                        
##  [64] "Male"                                                                                                  
##  [65] "Male,Male,Male"                                                                                        
##  [66] "Male"                                                                                                  
##  [67] "Male,Male,Male"                                                                                        
##  [68] "Male,Male,Male"                                                                                        
##  [69] "Male,Male,Male"                                                                                        
##  [70] "NULL"                                                                                                  
##  [71] "NULL"                                                                                                  
##  [72] "Male"                                                                                                  
##  [73] "NULL"                                                                                                  
##  [74] "NULL"                                                                                                  
##  [75] "Male"                                                                                                  
##  [76] "NULL"                                                                                                  
##  [77] "NULL"                                                                                                  
##  [78] "Male"                                                                                                  
##  [79] "NULL"                                                                                                  
##  [80] "Female"                                                                                                
##  [81] "Male"                                                                                                  
##  [82] "NULL"                                                                                                  
##  [83] "NULL"                                                                                                  
##  [84] "Female,Male,"                                                                                          
##  [85] "NULL"                                                                                                  
##  [86] "NULL"                                                                                                  
##  [87] "Male"                                                                                                  
##  [88] "NULL"                                                                                                  
##  [89] "NULL"                                                                                                  
##  [90] "Male,Male"                                                                                             
##  [91] "NULL"                                                                                                  
##  [92] "NULL"                                                                                                  
##  [93] "NULL"                                                                                                  
##  [94] "Male,Female"                                                                                           
##  [95] "NULL"                                                                                                  
##  [96] "NULL"                                                                                                  
##  [97] "NULL"                                                                                                  
##  [98] "NULL"                                                                                                  
##  [99] "NULL"                                                                                                  
## [100] "Male"                                                                                                  
## [101] "Male"                                                                                                  
## [102] "NULL"                                                                                                  
## [103] "NULL"                                                                                                  
## [104] "NULL"                                                                                                  
## [105] "NULL"                                                                                                  
## [106] "NULL"                                                                                                  
## [107] "NULL"                                                                                                  
## [108] "NULL"                                                                                                  
## [109] "Male,Male,Male"                                                                                        
## [110] "NULL"                                                                                                  
## [111] "Male"                                                                                                  
## [112] "Male,Male,Male"                                                                                        
## [113] "NULL"                                                                                                  
## [114] "NULL"                                                                                                  
## [115] "Male"                                                                                                  
## [116] "Female"                                                                                                
## [117] "Male,Male,Male,Male"                                                                                   
## [118] "Female"                                                                                                
## [119] "NULL"                                                                                                  
## [120] "NULL"                                                                                                  
## [121] "Male"                                                                                                  
## [122] "NULL"                                                                                                  
## [123] "Male"                                                                                                  
## [124] "Male,Female"                                                                                           
## [125] "NULL"                                                                                                  
## [126] "NULL"                                                                                                  
## [127] "Male"                                                                                                  
## [128] "NULL"                                                                                                  
## [129] "NULL"                                                                                                  
## [130] "Male"                                                                                                  
## [131] "NULL"                                                                                                  
## [132] "NULL"                                                                                                  
## [133] "Male"                                                                                                  
## [134] "Male"                                                                                                  
## [135] "Male"                                                                                                  
## [136] "Male"                                                                                                  
## [137] "Male"                                                                                                  
## [138] "Male"                                                                                                  
## [139] "Male,Male"                                                                                             
## [140] "Male"                                                                                                  
## [141] "Male"                                                                                                  
## [142] "Male"                                                                                                  
## [143] "Male"                                                                                                  
## [144] "Male"                                                                                                  
## [145] "Male,Male"                                                                                             
## [146] "Male"                                                                                                  
## [147] "Male"                                                                                                  
## [148] "Male"                                                                                                  
## [149] "Male"                                                                                                  
## [150] "Female"                                                                                                
## [151] "Male"                                                                                                  
## [152] "Male"                                                                                                  
## [153] "NULL"                                                                                                  
## [154] "Male"                                                                                                  
## [155] "Male"                                                                                                  
## [156] "Male"                                                                                                  
## [157] "NULL"                                                                                                  
## [158] "Male,Male"                                                                                             
## [159] "Male"                                                                                                  
## [160] "Male"                                                                                                  
## [161] "Male"                                                                                                  
## [162] "Male"                                                                                                  
## [163] "NULL"                                                                                                  
## [164] "Male"                                                                                                  
## [165] "NULL"                                                                                                  
## [166] "NULL"                                                                                                  
## [167] "NULL"                                                                                                  
## [168] "Male"                                                                                                  
## [169] "Male"                                                                                                  
## [170] "NULL"                                                                                                  
## [171] "NULL"                                                                                                  
## [172] "NULL"                                                                                                  
## [173] "NULL"                                                                                                  
## [174] "Female"                                                                                                
## [175] "Male"                                                                                                  
## [176] "Male"                                                                                                  
## [177] "Male,Male,Male,Female"                                                                                 
## [178] "NULL"                                                                                                  
## [179] "Male"                                                                                                  
## [180] "NULL"                                                                                                  
## [181] "Male"                                                                                                  
## [182] "Male"                                                                                                  
## [183] "Male"                                                                                                  
## [184] "NULL"                                                                                                  
## [185] "NULL"                                                                                                  
## [186] "NULL"                                                                                                  
## [187] "Male"                                                                                                  
## [188] "NULL"                                                                                                  
## [189] "Male,Male"                                                                                             
## [190] "Female"                                                                                                
## [191] "Male"                                                                                                  
## [192] "Male"                                                                                                  
## [193] "Male"                                                                                                  
## [194] "Male"                                                                                                  
## [195] "NULL"                                                                                                  
## [196] "NULL"                                                                                                  
## [197] "Male"                                                                                                  
## [198] "Male"                                                                                                  
## [199] "Male"                                                                                                  
## [200] "Male"                                                                                                  
## [201] "Male,Male"                                                                                             
## [202] "Male"                                                                                                  
## [203] "NULL"                                                                                                  
## [204] "Male"                                                                                                  
## [205] "Male"                                                                                                  
## [206] "NULL"                                                                                                  
## [207] "Female"                                                                                                
## [208] "Male,Male"                                                                                             
## [209] "Male"                                                                                                  
## [210] "Male"                                                                                                  
## [211] "Male"                                                                                                  
## [212] "Male"                                                                                                  
## [213] "Male"                                                                                                  
## [214] "NULL"                                                                                                  
## [215] "NULL"                                                                                                  
## [216] "Male"                                                                                                  
## [217] "Male"                                                                                                  
## [218] "NULL"                                                                                                  
## [219] "NULL"                                                                                                  
## [220] "Male"                                                                                                  
## [221] "Male,Female,Male,Male,Male"                                                                            
## [222] "NULL"                                                                                                  
## [223] "NULL"                                                                                                  
## [224] "NULL"                                                                                                  
## [225] "NULL"                                                                                                  
## [226] "NULL"                                                                                                  
## [227] "NULL"                                                                                                  
## [228] "NULL"                                                                                                  
## [229] "NULL"                                                                                                  
## [230] "Male"                                                                                                  
## [231] "NULL"                                                                                                  
## [232] "NULL"                                                                                                  
## [233] "NULL"                                                                                                  
## [234] "NULL"                                                                                                  
## [235] "Female"                                                                                                
## [236] "Male,Female,Male"                                                                                      
## [237] "Male"                                                                                                  
## [238] "Female"                                                                                                
## [239] "NULL"                                                                                                  
## [240] "Male"                                                                                                  
## [241] "Male"                                                                                                  
## [242] "NULL"                                                                                                  
## [243] "Male"                                                                                                  
## [244] "Male"                                                                                                  
## [245] "Male,Male"                                                                                             
## [246] "Male,Male,Male,Female,Male,Male"                                                                       
## [247] "Male"                                                                                                  
## [248] "Male"                                                                                                  
## [249] "Male"                                                                                                  
## [250] "Male"                                                                                                  
## [251] "Male"                                                                                                  
## [252] "Male,Male"                                                                                             
## [253] "Female,Male,Male,Female"                                                                               
## [254] "Male"                                                                                                  
## [255] "NULL"                                                                                                  
## [256] "Male,Male"                                                                                             
## [257] "Male"                                                                                                  
## [258] "NULL"                                                                                                  
## [259] "Male"                                                                                                  
## [260] "Male"                                                                                                  
## [261] "Male"                                                                                                  
## [262] "Male"                                                                                                  
## [263] "Male"                                                                                                  
## [264] "Male,Male,Female,Male"                                                                                 
## [265] "Male"                                                                                                  
## [266] "Male"                                                                                                  
## [267] "Male"                                                                                                  
## [268] "Male"                                                                                                  
## [269] "Female"                                                                                                
## [270] "Male"                                                                                                  
## [271] "Male,Male"                                                                                             
## [272] "Male"                                                                                                  
## [273] "Male"                                                                                                  
## [274] "Male"                                                                                                  
## [275] "Male"                                                                                                  
## [276] "NULL"                                                                                                  
## [277] "Male,Male,Male,Male"                                                                                   
## [278] "Male"                                                                                                  
## [279] "Male"                                                                                                  
## [280] "Male"                                                                                                  
## [281] "Male,Male,Male,Male"                                                                                   
## [282] "Male"                                                                                                  
## [283] "NULL"                                                                                                  
## [284] "Male"                                                                                                  
## [285] "Male"                                                                                                  
## [286] "Male"                                                                                                  
## [287] "Male"                                                                                                  
## [288] "Male,Male,Male,Male,Female"                                                                            
## [289] "Male,Male,Male,Male,Male,Male"                                                                         
## [290] "Male,Male,Female"                                                                                      
## [291] "Male,Male,Male"                                                                                        
## [292] "Female,Male"                                                                                           
## [293] "Male,Male,Male,Male,Male"                                                                              
## [294] "Male,Male,Female,Male"                                                                                 
## [295] "Female,Female,Female,Female"                                                                           
## [296] "Male,Male,Male"                                                                                        
## [297] "Male,Male,Male"                                                                                        
## [298] "Male,Male,Male,Male,Male"                                                                              
## [299] "Male,Male,Male"                                                                                        
## [300] "Male,Male,Male,Male,Male,Male,Male"                                                                    
## [301] "Male,Male,Male,Male"                                                                                   
## [302] "Male"                                                                                                  
## [303] "Male"                                                                                                  
## [304] "Male"                                                                                                  
## [305] "Male"                                                                                                  
## [306] "Male"                                                                                                  
## [307] "Male"                                                                                                  
## [308] "Female,Male,Male,Male"                                                                                 
## [309] "Male"                                                                                                  
## [310] "Male"                                                                                                  
## [311] "Male"                                                                                                  
## [312] "Male"                                                                                                  
## [313] "Male,Male,Male,Female,Female,Female,Male,Male,Male,Female,Male,Male,Male,Male,Male,Male,Male,Male,Male"
## [314] "Male"                                                                                                  
## [315] "Male"                                                                                                  
## [316] "Male"                                                                                                  
## [317] "Male"                                                                                                  
## [318] "Male"                                                                                                  
## [319] "Male"                                                                                                  
## [320] "Male"                                                                                                  
## [321] "Male"                                                                                                  
## [322] "Male"                                                                                                  
## [323] "NULL"                                                                                                  
## [324] "Male"                                                                                                  
## [325] "Male"                                                                                                  
## [326] "Male"                                                                                                  
## [327] "Male"                                                                                                  
## [328] "Male"                                                                                                  
## [329] "Male"                                                                                                  
## [330] "NULL"                                                                                                  
## [331] "Female"                                                                                                
## [332] "NULL"                                                                                                  
## [333] "Male"                                                                                                  
## [334] "NULL"                                                                                                  
## [335] "Male"                                                                                                  
## [336] "Male,Male,Male,Male,Female,Female,Male"                                                                
## [337] "Male,Female,Male,Male,Male"                                                                            
## [338] "Male,Male"                                                                                             
## [339] "Male,Male,Male"                                                                                        
## [340] "Male"                                                                                                  
## [341] "Male,Male,Male"                                                                                        
## [342] "Male,Male,Male,Male,Male,Male,Female,Female,Female,Male"                                               
## [343] "Male"                                                                                                  
## [344] "Male"                                                                                                  
## [345] "Male"                                                                                                  
## [346] "Male"                                                                                                  
## [347] "Male,Male"                                                                                             
## [348] "Female"                                                                                                
## [349] "Male"                                                                                                  
## [350] "Male"                                                                                                  
## [351] "Male"                                                                                                  
## [352] "Female"                                                                                                
## [353] "Male"                                                                                                  
## [354] "Male,Female,Male"                                                                                      
## [355] "Male"                                                                                                  
## [356] "Male"                                                                                                  
## [357] "Male,Male,Male,Male"                                                                                   
## [358] "Male"                                                                                                  
## [359] "Male,Male"                                                                                             
## [360] "Male,Male,Male,Female,Male,Male,Female,Female"                                                         
## [361] "Male"                                                                                                  
## [362] "Male,Male,Male,Male,Male,Male,Male"                                                                    
## [363] "Male,Female"                                                                                           
## [364] "Male"                                                                                                  
## [365] "Male,Male"                                                                                             
## [366] "Male"                                                                                                  
## [367] "Male"                                                                                                  
## [368] "Male"                                                                                                  
## [369] "Male,Male"                                                                                             
## [370] "Male"                                                                                                  
## [371] "Male"                                                                                                  
## [372] "Male,Male"                                                                                             
## [373] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                
## [374] "Male"                                                                                                  
## [375] "Female,Female"                                                                                         
## [376] "Male,Male"                                                                                             
## [377] "Male,Male,Male"                                                                                        
## [378] "Male,Male"                                                                                             
## [379] "Male,Female,Female,Male,Male"                                                                          
## [380] "Male"                                                                                                  
## [381] "Male"                                                                                                  
## [382] "Male"                                                                                                  
## [383] "Male"                                                                                                  
## [384] "Male"                                                                                                  
## [385] "Male"                                                                                                  
## [386] "Male"                                                                                                  
## [387] "Male"                                                                                                  
## [388] "Male"                                                                                                  
## [389] "Male,Male"                                                                                             
## [390] "Female,Male,Male"                                                                                      
## [391] "Male"                                                                                                  
## [392] "Male,Male,Female,Male"                                                                                 
## [393] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                            
## [394] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Female"                     
## [395] "Male,Male,Male,Male,Male,Male,Male"                                                                    
## [396] "Male,Male,Male,Male"                                                                                   
## [397] "Male,Male,Male,Male,Male,Male,Male"                                                                    
## [398] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                
## [399] "Male,Male,Male,Male,Male,Male,Male"                                                                    
## [400] "Male,Male,Male"                                                                                        
## [401] "Male,Male,Male,Male,Male,Male"                                                                         
## [402] "Male,Male,Male,Male,Male,Male"                                                                         
## [403] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                
## [404] "Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                          
## [405] "Male,Male,Male,Female,Male"                                                                            
## [406] "Male"                                                                                                  
## [407] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                     
## [408] "Male,Male,Male,Male,Male,Male,Male,Male"                                                               
## [409] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                     
## [410] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                      
## [411] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                
## [412] "Male,Male,Male,Male"                                                                                   
## [413] "Male,Male,Male,Male,Male,Male,Male,Male"                                                               
## [414] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                           
## [415] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                      
## [416] "Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                          
## [417] "Male,Male,Male,Male,Male,Male,Male,Male,Male"                                                          
## [418] "Male,Male,Male,Male,Male,Male,Male,Male"                                                               
## [419] "Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male,Male"                                           
## [420] "Male,Male,Male,Male,Male,Male"                                                                         
## [421] "Male,Male"                                                                                             
## [422] "Male,Male,Female"                                                                                      
## [423] "Male,Female"                                                                                           
## [424] "Male"                                                                                                  
## [425] "Male,Female,Male"                                                                                      
## [426] "Male"                                                                                                  
## [427] "Male"                                                                                                  
## [428] "Male,Male"                                                                                             
## [429] "Female"                                                                                                
## [430] "Male"                                                                                                  
## [431] "Male"                                                                                                  
## [432] "Male,Male"                                                                                             
## [433] "Male,Male,Female"                                                                                      
## [434] "Male"                                                                                                  
## [435] "Female"                                                                                                
## [436] "Male"                                                                                                  
## [437] "Male"                                                                                                  
## [438] "Female,Male"                                                                                           
## [439] "Male"                                                                                                  
## [440] "Male"                                                                                                  
## [441] "Female"                                                                                                
## [442] "Male"                                                                                                  
## [443] "Male"                                                                                                  
## [444] "Male"                                                                                                  
## [445] "Male,Male,Male,Male"                                                                                   
## [446] "Male"                                                                                                  
## [447] "Male"                                                                                                  
## [448] "Male"                                                                                                  
## [449] "Male"                                                                                                  
## [450] "Female"                                                                                                
## [451] "Male"                                                                                                  
## [452] "Male,Male"                                                                                             
## [453] "Male"                                                                                                  
## [454] "Male"                                                                                                  
## [455] "Male"                                                                                                  
## [456] "Male,Female"                                                                                           
## [457] "Male"                                                                                                  
## [458] "Male"                                                                                                  
## [459] "Male"                                                                                                  
## [460] "Male"                                                                                                  
## [461] "Male"                                                                                                  
## [462] "Female"                                                                                                
## [463] "Male"                                                                                                  
## [464] "Male"                                                                                                  
## [465] "Male,Female"                                                                                           
## [466] "Male"                                                                                                  
## [467] "Male"                                                                                                  
## [468] "Male"                                                                                                  
## [469] "Male"                                                                                                  
## [470] "Male,Male,Male,Male"                                                                                   
## [471] "Male"                                                                                                  
## [472] "Male"                                                                                                  
## [473] "Male,Male,Female"                                                                                      
## [474] "Male,Female"                                                                                           
## [475] "Male,Male,Male,Male"                                                                                   
## [476] "Male"                                                                                                  
## [477] "Male"                                                                                                  
## [478] "Male,Female"                                                                                           
## [479] "Male"                                                                                                  
## [480] "Female"                                                                                                
## [481] "Male"                                                                                                  
## [482] "Male"                                                                                                  
## [483] "Male,Male"                                                                                             
## [484] "Male,Male"                                                                                             
## [485] "Male"                                                                                                  
## [486] "Male"                                                                                                  
## [487] "Male"                                                                                                  
## [488] "Male"                                                                                                  
## [489] "Male"                                                                                                  
## [490] "Male,Male"                                                                                             
## [491] "Male"                                                                                                  
## [492] "Male"                                                                                                  
## [493] "Female,Male,Female,Male"                                                                               
## [494] "Male"                                                                                                  
## [495] "Male"                                                                                                  
## [496] "Male,Male"                                                                                             
## [497] "Male"                                                                                                  
## [498] "Male"                                                                                                  
## [499] "Male"                                                                                                  
## [500] "Male"                                                                                                  
## [501] "Male"                                                                                                  
## [502] "Female"                                                                                                
## [503] "Male"                                                                                                  
## [504] "Male"                                                                                                  
## [505] "Male"                                                                                                  
## [506] "Male"                                                                                                  
## [507] "Male"                                                                                                  
## [508] "Male"                                                                                                  
## [509] "Male"                                                                                                  
## [510] "Male"                                                                                                  
## [511] "Male"                                                                                                  
## [512] "Male"                                                                                                  
## [513] "Male"                                                                                                  
## [514] "Male,Male,Male"                                                                                        
## [515] "Male"                                                                                                  
## [516] "Male,Male"                                                                                             
## [517] "Male"                                                                                                  
## [518] "Male"                                                                                                  
## [519] "Female"                                                                                                
## [520] "Male"                                                                                                  
## [521] "Male"                                                                                                  
## [522] "Male,Male,Male"                                                                                        
## [523] "Male"                                                                                                  
## [524] "Male,Female"                                                                                           
## [525] "Male"                                                                                                  
## [526] "Male"                                                                                                  
## [527] "Male"                                                                                                  
## [528] "Male"                                                                                                  
## [529] "Male"                                                                                                  
## [530] "Male,Male,Male,Male,Female,Male,Male,Male"                                                             
## [531] "Female,Male"                                                                                           
## [532] "Male"                                                                                                  
## [533] "Male"                                                                                                  
## [534] "Male,Female,Male,Male"                                                                                 
## [535] "Male"                                                                                                  
## [536] "Female"                                                                                                
## [537] "Male"                                                                                                  
## [538] "Male"                                                                                                  
## [539] "Female"                                                                                                
## [540] "Male"                                                                                                  
## [541] "Male"                                                                                                  
## [542] "Male"                                                                                                  
## [543] "Female"                                                                                                
## [544] "Male"                                                                                                  
## [545] "Male"                                                                                                  
## [546] "Male"                                                                                                  
## [547] "Male"                                                                                                  
## [548] "Male"                                                                                                  
## [549] "Male"                                                                                                  
## [550] "Male"                                                                                                  
## [551] "Male"                                                                                                  
## [552] "Male"                                                                                                  
## [553] "Male,Male"                                                                                             
## [554] "NULL"                                                                                                  
## [555] "Male"                                                                                                  
## [556] "Male"                                                                                                  
## [557] "Male"                                                                                                  
## [558] "Male"                                                                                                  
## [559] "Male"                                                                                                  
## [560] "Male"                                                                                                  
## [561] "Male"                                                                                                  
## [562] "Male,Female,Female,Male,Male"                                                                          
## [563] "Male"                                                                                                  
## [564] "Male"                                                                                                  
## [565] "Male,Male"                                                                                             
## [566] "Male"                                                                                                  
## [567] "Male"                                                                                                  
## [568] "Male,Male"                                                                                             
## [569] "Female"                                                                                                
## [570] "Male"                                                                                                  
## [571] "Male"                                                                                                  
## [572] "Male"                                                                                                  
## [573] "Male,Male,Male,Male"                                                                                   
## [574] "Male"                                                                                                  
## [575] "Male"                                                                                                  
## [576] "Male,Male,Male,Male,Male,Male,Male,Female,Male,Male,Male,Male"                                         
## [577] "Male"                                                                                                  
## [578] "Male"                                                                                                  
## [579] "Male"                                                                                                  
## [580] "Male"                                                                                                  
## [581] "Female"                                                                                                
## [582] "Female"                                                                                                
## [583] "Male,Male"                                                                                             
## [584] "Female"                                                                                                
## [585] "Male"                                                                                                  
## [586] "Male"                                                                                                  
## [587] "Male"                                                                                                  
## [588] "Male"                                                                                                  
## [589] "Male"                                                                                                  
## [590] "Male"                                                                                                  
## [591] "Male"                                                                                                  
## [592] "Male"                                                                                                  
## [593] "Male"                                                                                                  
## [594] "Male"                                                                                                  
## [595] "Male"                                                                                                  
## [596] "Male"                                                                                                  
## [597] "Male"                                                                                                  
## [598] "Male"                                                                                                  
## [599] "Male,Male,Male,Male"                                                                                   
## [600] "Male,Male"                                                                                             
## [601] "Female,Male"                                                                                           
## [602] "Male,Male,Male"                                                                                        
## [603] "Male"
str_detect(scooby$monster_type, "Animal")
##   [1] FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE
##  [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
##  [25] FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE
##  [37] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
##  [49] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
##  [61] FALSE  TRUE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
##  [85] FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE
##  [97] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [109]  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE
## [121] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
## [133]  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE
## [145]  TRUE FALSE FALSE  TRUE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
## [157] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
## [169] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE
## [181]  TRUE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE
## [193] FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE
## [205] FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE
## [217] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [229] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
## [241]  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE  TRUE  TRUE FALSE  TRUE  TRUE
## [253] FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
## [265] FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE
## [277] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE  TRUE
## [289]  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [301] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
## [313]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [325] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE
## [337]  TRUE  TRUE FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE FALSE FALSE FALSE
## [349] FALSE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
## [361]  TRUE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE
## [373]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [385] FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE
## [397] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
## [409] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE
## [421] FALSE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE
## [433]  TRUE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
## [445]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [457] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
## [469] FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
## [481] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE
## [493] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE
## [505] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [517] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE FALSE FALSE
## [529]  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE
## [541] FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [553] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE
## [565]  TRUE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE
## [577] FALSE  TRUE  TRUE FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE FALSE FALSE
## [589]  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE
## [601] FALSE FALSE FALSE
sum(str_detect(scooby$monster_type, "Animal"))
## [1] 128
scooby %>% 
    summarize(num_Animal = sum(str_detect(monster_type, "Animal")))
## # A tibble: 1 × 1
##   num_Animal
##        <int>
## 1        128

Extract matches

scooby %>% 
    mutate(col_Animal = str_extract(monster_type, "Animal")) %>%
    select(monster_type, col_Animal) %>%
    filter(!is.na(col_Animal))
## # A tibble: 128 × 2
##    monster_type                                                       col_Animal
##    <chr>                                                              <chr>     
##  1 Animal                                                             Animal    
##  2 Animal,Undead,Undead                                               Animal    
##  3 Animal                                                             Animal    
##  4 Animal,Ancient,Ancient,Mechanical,Plant                            Animal    
##  5 Animal                                                             Animal    
##  6 Ghost,Disguised,Undead,Disguised,Animal,Animal,Animal,Ancient,Dis… Animal    
##  7 Animal,Animal                                                      Animal    
##  8 Ghost,Animal                                                       Animal    
##  9 Animal,Undead,Disguised,Animal,Disguise,Ghost,Ghost,Animal         Animal    
## 10 Disguised,Animal                                                   Animal    
## # ℹ 118 more rows

Replacing matches

scooby %>%
    mutate(col_Ghost = str_replace(monster_type, "Animal", "Ghost")) %>%
    select(monster_type, col_Ghost)
## # A tibble: 603 × 2
##    monster_type     col_Ghost       
##    <chr>            <chr>           
##  1 Possessed Object Possessed Object
##  2 Ghost            Ghost           
##  3 Ghost            Ghost           
##  4 Ancient          Ancient         
##  5 Ancient          Ancient         
##  6 Ghost            Ghost           
##  7 Animal           Ghost           
##  8 Mechanical       Mechanical      
##  9 Ghost            Ghost           
## 10 Ghost            Ghost           
## # ℹ 593 more rows