I want to remove certain element from names.
names is a list of characters. After I run the following loop:
for (i in 1:length(names)){
  if((str_detect(names[[i]], "  Organisation Name")) || 
  (str_detect(names[[i]], "^ $")) || (str_detect(names[[i]], "^0$")) || 
  (str_detect(names[[i]], "^$"))  ){
   names[[i]] <- NULL
 }
}
I get an error. The error is:
Error in names[[i]] : subscript out of bounds
 
     
    