Dear R Users,
if I have a string as follows
x<-"jsda23tth"
How can I extract out 23 as a numeral?
I found
substr(x,5,6)
but, this doesnt work if the number of alphabets differ.
This is another example where the numbers need to be extracted.
x<-c("jsda23tth","fgd54fgd","j3ngh","gfdjh564")
any ideas?
This didnt work.
grep("[/d]",x)
Thanks,
Roy
[[alternative HTML version deleted]]
______________________________________________
[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.