13.3 Substitute or remove matching patterns with gsub

From the same vector of email addresses:

  • Remove the “@” symbol and the email provider from each address
## [1] "marie.curie"        "albert.einstein01"  "charles.darwin1809"
## [4] "rosalind.franklin"
  • Substitute the “@” symbol with “at
## [1] "marie.curie_at_yahoo.es"          "albert.einstein01_at_hotmail.com"
## [3] "charles.darwin1809_at_gmail.com"  "rosalind.franklin_at_aol.it"
  • Substitute “es” and “it” by “eu”
## [1] "marie.curie@yahoo.eu"          "albert.einstein01@hotmail.com"
## [3] "charles.darwin1809@gmail.com"  "rosalind.franklin@aol.eu"