Hi,
May be this helps:
set.seed(25)
dat1<-
data.frame(ID=c("1001#01","1001#02","1001#03","1002#01","1002#02"),val=rnorm(5),stringsAsFactors=FALSE)
dat1$ID<-as.numeric(gsub("#.*","",dat1$ID))
dat1
# ID val
#1 1001 -0.2118336
#2 1001 -1.0415911
#3 1001 -1.1533076
#4 1002 0.3215315
#5 1002 -1.5001299
A.K.
>Hi all,
>
>I have a database with a colume ID have the ID numbers like this1001#01,
>1001#02, etc..
>
>How could I do to just extract 1001 out?
>
>Thanks,
>
>York
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.