[R] R help
arun
smartpink111 at yahoo.com
Thu Feb 6 06:46:20 CET 2014
Hi,
May be this helps:
dat <- read.table(text="Emails
Mal123 at gmail.com
Mahi.r at gmail.com
Ravi_123 at yahoo.com
Lavk.lll at rediff.com",sep="",header=TRUE,stringsAsFactors=FALSE)
setNames(cbind(dat,do.call(rbind,strsplit(gsub(".com","",gsub("^([[:alpha:]]+)(\\d+.*)","\\1_\\2",dat$Emails)),"[_ at .]"))),c("Emails","f.name","l.name","domain"))
# Emails f.name l.name domain
#1 Mal123 at gmail.com Mal 123 gmail
#2 Mahi.r at gmail.com Mahi r gmail
#3 Ravi_123 at yahoo.com Ravi 123 yahoo
#4 Lavk.lll at rediff.com Lavk lll rediff
A.K.
Hi,
Emails
Mal123 at gmail.com
Mahi.r at gmail.com
Ravi_123 at yahoo.com
Lavk.lll at rediff.com
I need split firstname,lastname,domail(only gmail,not gmail.com),also 123 in
last name,so please give me help
Output is
Emails f.name l.name domain
Mal123 at gmail.com mal 123 gmail
Mahi.r at gmail.com mahi r gmail
Ravi_123 at yahoo.com ravi 123 gmail
Lavk.lll at rediff.com
Please give me solution
More information about the R-help
mailing list