Liaw, Andy wrote: > Just gsub() non-numerics with ""; e.g.: > > >>gsub("[a-zA-Z]", "", "aB9c81") > > [1] "981" > > [I'm really bad in regular expressions, and don't know how to construct > "non-numerics".] > Use a ^ to negate a character range: > gsub("[^0-9]", "", "aB9c81") [1] "981" Baz