Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- d$domain<-strsplit( d$email, "@")[[1]]
- for (i in 1:length(row.names(d)){
- d$domain[i]<-unlist(strsplit( d$email[i], "@"))[2]
- }
- d <- data.frame(email=rep(bob@bob.com, 10))
- d$address <- gsub("@.*", "", d$email)
- d$domain <- gsub(".*@", "", d$email)
- library(stringr)
- str_split_fixed(d$email, "@", n = 2)
- name <- "fakename@email.com"
- splitname <- strsplit(name, "@")
- emailid <- sapply(splitname, "[", 1)
- domain <- sapply(splitname, "[", 2)
- matrix(unlist(strsplit(name,"@")),nrow=2)
- parse.email <- function(emails) {
- email.list <- strsplit(emails, split = '@')
- # Preallocate the vectors
- n <- length(email.list)
- local <- vector(length = n)
- domain <- vector(length = n)
- for (i in 1:n){
- local[i] <- email.list[[i]][1]
- domain[i] <- email.list[[i]][2]
- }
- l <- list(local, domain)
- names(l) <- c('local', 'domain')
- return(l)}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement