Displaying 2 results from an estimated 2 matches for "gorp20".
Did you mean:
  gor20
  
2017 Aug 23
4
Flummoxed by gsub().
I have a vector (say "x") of the form
     [1] "mung5"  "mung10" "mung20" "gorp5"  "gorp10" "gorp20"
I want to extract just the numbers (strings of digits) that appear at 
the end of the strings in "x".
My reading of ?regex led me to believe that
     gsub("[:alpha:]","",x)
should give the result that I want.  However it returns
     [1] "mung5"...
2017 Aug 23
0
Flummoxed by gsub().
...23, 2017 7:46 AM
> To: r-help mailing list <r-help at r-project.org>
> Subject: [R] Flummoxed by gsub().
>
>
> I have a vector (say "x") of the form
>
>      [1] "mung5"  "mung10" "mung20" "gorp5"  "gorp10" "gorp20"
>
> I want to extract just the numbers (strings of digits) that appear at the end of
> the strings in "x".
>
> My reading of ?regex led me to believe that
>
>      gsub("[:alpha:]","",x)
>
> should give the result that I want.  However...