Hello, I would like to combine two strings while using R. For instance, string1 <- "abcde" string2 <- "WXYZ" I'd like to combine string1 and string2 into Sting3; and string3 should be "abcdeWXZY". Would you please tell me how to do it? Thank you very much Ben-Yang [[alternative HTML version deleted]]
Use string3 <- paste(string1, string2, sep=""). Andy> From: Ben-Yang Liao > Sent: Thursday, December 02, 2004 6:23 PM > To: r-help at stat.math.ethz.ch > Subject: [R] combine two strings > > > Hello, > > I would like to combine two strings while using R. > For instance, > string1 <- "abcde" > string2 <- "WXYZ" > I'd like to combine string1 and string2 into Sting3; > and string3 should be "abcdeWXZY". > Would you please tell me how to do it? > Thank you very much > > Ben-Yang > [[alternative HTML version deleted]] > > ______________________________________________ > 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 > >
Ben-Yang Liao wrote:>Hello, > >I would like to combine two strings while using R. >For instance, >string1 <- "abcde" >string2 <- "WXYZ" >I'd like to combine string1 and string2 into Sting3; >and string3 should be "abcdeWXZY". > >paste(string1, string2, sep="")>Would you please tell me how to do it? >Thank you very much > >Ben-Yang > [[alternative HTML version deleted]] > >______________________________________________ >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 > > > >-- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra
x<-paste(string1, string2, sep="") On Thu, 2 Dec 2004 18:23:28 -0500 "Ben-Yang Liao" <liaoby at umich.edu> wrote:> Hello, > > I would like to combine two strings while using R. > For instance, > string1 <- "abcde" > string2 <- "WXYZ" > I'd like to combine string1 and string2 into Sting3; > and string3 should be "abcdeWXZY". > Would you please tell me how to do it? > Thank you very much > > Ben-Yang > [[alternative HTML version deleted]] > > ______________________________________________ > 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