Dear all,

 

I have a vector, which looks about like this:

 

str <- c("14.XYZ", "15.ABCDE", "16.dkieowo", "120.EIDKAI")

 

I need to extract the numerical characters out of the string, so I receive
in the end a normal vector containing:

 

vec <- c(14, 15, 16, 120)

 

I need a generic solution for this. My actual vector contains about 403
strings, and it is bound to change with different versions of my
calculations. So I need something that either extracts all numeric
characters or deletes everything else.

 

I hope you can help me out.

 

Best,

Karl

 

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to