[R] help with gsub and grep functions

Martin Olivier martinol at ensam.inra.fr
Mon Oct 13 16:30:37 CEST 2003


Hi all,

Let Names a vector of chatacters. For example,

 > Names
[1] "g 604 be-0 -p1 (602 matches)" "g 606 Phli-0 -p2 (517 matches)"
[3] "g 608 alu-0  (659 matches)"

I try to use gsub or grep functions for two problems :

1. First, I would like to delete all the characters between parentheses.
[1] "g 604 be-0 -p1" "g 606 be-0 -p2"
[3] "g 608 be-0 -p3"

2. And, I would like to extract the characters between parentheses
[1] "602 matches" "517 matches"
[3] "659 matches"



Any idea?

Best regards,
Olivier

-- 

-------------------------------------------------------------
Martin Olivier
INRA - Unité protéomique           LIRMM - IFA/MAB
2, Place Viala                     161, rue Ada
34060 Montpellier Cédex 1          34392 Montpellier Cédex 5	

Tel : 04 99 61 27 01               Tel : O4 67 41 86 71
martinol at ensam.inra.fr             martin at lirmm.fr




More information about the R-help mailing list