[R] selection of character

From: Leonardo Lami <lami_at_faunalia.it>
Date: Wed 04 Apr 2007 - 14:11:13 GMT


Hi all,

I have a simple question:
I have a character vector like this

 [1] "10_1" "1_1"  "11_1" "2_1"  "3_1"  "4_1"  "5_1"  "6_1"  "7_1"  "8_1"

[11] "9_1" "1_3" "2_3" "3_3" "4_3" "1_4" "2_4" "3_4" "4_4" "5_4"
[21] "6_4" "7_4" "1_5" "2_5" "10_6" "11_6" "12_6" "1_6" "2_6" "3_6"
[31] "4_6" "5_6" "6_6" "7_6" "8_6" "9_6" "1_7" "1_8" "2_8" "3_8"
[41] "10_9" "1_9" "2_9" "3_9" "4_9" "5_9" "6_9" "7_9" "8_9" "9_9"
[43] "1_10" "2_10"

and I'd like to have a vector with only the value after the under scor, like this:

 [1] "1" "1"  "1" "1"  "1"  "1"  "1"  "1"  "1"  "1"

[11] "1" "3" "3" "3" "3" "4" "4" "4" "4" "4"
[21] "4" "4" "5" "5" "6" "6" "6" "6" "6" "6"
[31] "6" "6" "6" "6" "6" "6" "7" "8" "8" "8"
[41] "9" "9" "9" "9" "9" "9" "9" "9" "9" "9"
[43] "10" "10"

Is there a simple function to do this?

Thank you for your help
All the best

Leonardo



R-help@stat.math.ethz.ch 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. Received on Thu Apr 05 00:15:33 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 04 Apr 2007 - 14:30:57 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.