[R] help with string split in R

2013-06-17 Thread CompBiol ATL
#I want to remove '_alpha' in a vector of strings myInput = c( afg3_alpha, alg12_alpha, dbp3_alpha, elp4_alpha, fob1_alpha, gpr1_alpha) #my current solution tmpsplit = strsplit(myInput, '_') tmp = NA for (item in tmpsplit){ tmp = c(tmp, item[1]) } results1 = tmp[-1]; #this is what I need,

Re: [R] help with string split in R

2013-06-17 Thread Jeff Newmiller
?sub --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#..

Re: [R] help with string split in R

2013-06-17 Thread arun
gsub(_.*,,myInput) #[1] afg3  alg12 dbp3  elp4  fob1  gpr1 A.K. - Original Message - From: CompBiol ATL along...@gmail.com To: r-help@r-project.org Cc: Hong Qin qins...@gmail.com Sent: Monday, June 17, 2013 6:52 PM Subject: [R] help with string split in R #I want to remove '_alpha