[R] gsub

Luis Ridao Cruz Luisr at frs.fo
Wed Nov 15 14:29:20 CET 2006


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)
>



More information about the R-help mailing list