[R] gsub

john seers (IFR) john.seers at bbsrc.ac.uk
Wed Nov 15 16:29:39 CET 2006



Is this what you want?  :

gsub("cpue\|nogd", "", string)


John
 
---

Web sites:

www.ifr.ac.uk   
www.foodandhealthnetwork.com


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Luis Ridao Cruz
Sent: 15 November 2006 13:29
To: r-help at stat.math.ethz.ch
Subject: [R] gsub


R-help,

I want to remove the following strings
"cpue" and "nogd"

string <- c("upsanogd" ,    "toskanogd" ,   "hysunogd"   ,  "konganogd"
  
 ,"gullaksnogd" , "longunogd"  ,  "blalongunogd"  , "brosmunogd")

I could use first : first <- gsub("cpue" , "", string)
and then : second <- gsub("nogd" , "", first)

Can it be done at once?

Thanks in advance


> version
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          4.0                         
year           2006                        
month          10                          
day            03                          
svn rev        39566                       
language       R                           
version.string R version 2.4.0 (2006-10-03)
>

______________________________________________
R-help at 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.



More information about the R-help mailing list