Re: [R] how to replace the following string

2011-06-27 Thread Changbin Du
Thanks, Jim! It is exactly what I want, appreciated! On Mon, Jun 27, 2011 at 10:22 AM, jim holtman wrote: > Is this what you want: > > > test > [1] "H.1.Y" "N.0.E" "G.1.N" "E.0.P" "W.2.G" "W.4.G" "W.3.W" "W.0.N" "D.1.H" > > sub("\\.([0-9]+)\\.", "{\\1}", test) > [1] "H{1}Y" "N{0}E" "G{1}N" "E

Re: [R] how to replace the following string

2011-06-27 Thread jim holtman
Is this what you want: > test [1] "H.1.Y" "N.0.E" "G.1.N" "E.0.P" "W.2.G" "W.4.G" "W.3.W" "W.0.N" "D.1.H" > sub("\\.([0-9]+)\\.", "{\\1}", test) [1] "H{1}Y" "N{0}E" "G{1}N" "E{0}P" "W{2}G" "W{4}G" "W{3}W" "W{0}N" "D{1}H" > On Mon, Jun 27, 2011 at 1:18 PM, Changbin Du wrote: > HI,  Dear R-commun

[R] how to replace the following string

2011-06-27 Thread Changbin Du
HI, Dear R-community, I have one vector of the following string, > test<-c("H.1.Y", "N.0.E", "G.1.N", "E.0.P", "W.2.G", "W.4.G", "W.3.W", "W.0.N", "D.1.H") > test [1] "H.1.Y" "N.0.E" "G.1.N" "E.0.P" "W.2.G" "W.4.G" "W.3.W" "W.0.N" "D.1.H" *I want to change them into* "H{1}Y" "N{0}E" "G{1}N" "