Running examples in ‘textclean-Ex.R’ failed
The error most likely occurred in:

> ### Name: replace_tokens
> ### Title: Replace Tokens
> ### Aliases: replace_tokens
> 
> ### ** Examples
> 
> replace_tokens(DATA$state, c('No', 'what', "it's"))
 [1] "Computer is fun. Not too fun."       "not, dumb."                         
 [3] "What should we do?"                  "You liar, it stinks!"               
 [5] "I am telling the truth!"             "How can we be certain?"             
 [7] "There is no way."                    "I distrust you."                    
 [9] "What are you talking about?"         "Shall we move on? Good then."       
[11] "I'm hungry. Let's eat. You already?"
> replace_tokens(DATA$state, c('No', 'what', "it's"), "<<TOKEN>>")
 [1] "Computer is fun. Not too fun."           
 [2] "<<TOKEN>> <<TOKEN>> not, <<TOKEN>> dumb."
 [3] "What should we do?"                      
 [4] "You liar, it stinks!"                    
 [5] "I am telling the truth!"                 
 [6] "How can we be certain?"                  
 [7] "There is no way."                        
 [8] "I distrust you."                         
 [9] "What are you talking about?"             
[10] "Shall we move on? Good then."            
[11] "I'm hungry. Let's eat. You already?"     
> replace_tokens(DATA$state, c('No', 'what', "it's"), "<<TOKEN>>", ignore.case = TRUE)
 [1] "Computer is fun. Not too fun."           
 [2] "<<TOKEN>> <<TOKEN>> not, <<TOKEN>> dumb."
 [3] "<<TOKEN>> should we do?"                 
 [4] "You liar, it stinks!"                    
 [5] "I am telling the truth!"                 
 [6] "How can we be certain?"                  
 [7] "There is <<TOKEN>> way."                 
 [8] "I distrust you."                         
 [9] "<<TOKEN>> are you talking about?"        
[10] "Shall we move on? Good then."            
[11] "I'm hungry. Let's eat. You already?"     
> 
> ## Now let's see the speed
> ## Set up data
> library(textshape)
> data(hamlet)
> set.seed(11)
> tokens <- sample(unique(unlist(split_token(hamlet$dialogue))), 2000)
> 
> tic <- Sys.time()
> head(replace_tokens(hamlet$dialogue, tokens))
[1] "Who's"                 "Nay answer me: stand." "Long live the king!"  
[4] "Bernardo"              "He."                   "You hour."            
> (toc <- Sys.time() - tic)
Time difference of 0.09173393 secs
> 
> 
> tic <- Sys.time()
> head(mgsub(hamlet$dialogue, tokens, ""))
Error in gsub(pattern[i], replacement[i], x, fixed = fixed, ...) : 
  zero-length pattern
Calls: head -> mgsub -> gsub
Execution halted