Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. Mail <- c("xxx1@xxx.xx", "xxx2@xxx.xx", "xxx3@yyy.xx", "xxx4@zzz.xx")
  2. InterestingPublishers <- c("zzz.xx", "xxx.xx")
  3.  
  4. Mail %in% InterestingPublishers
  5. FALSE FALSE FALSE FALSE
  6.  
  7. grepl(InterestingPublishers, Mail)
  8. Warning message:
  9. In grepl(InterestingPublishers, Mail) :
  10. argument 'pattern' has length > 1 and only the first element will be used
  11.  
  12. containsi <- integer()
  13. for (i in InterestingPublishers) {
  14. containsi <- c(containsi, grep(i, Mail))
  15. }
  16. Mail[containsi]
  17.  
  18. [1] "xxx4@zzz.xx" "xxx1@xxx.xx" "xxx2@xxx.xx"
  19.  
  20. Mail[unlist(lapply(InterestingPublishers, function(x) grep(x, Mail)))]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement