Re: [R] How does one do simple string concatenation?

From: ONKELINX, Thierry <Thierry.ONKELINX_at_inbo.be>
Date: Mon, 17 Mar 2008 12:09:54 +0100

have a look at the collapse argument in ?paste.

paste(paste(c("a","b","c"), collapse = ""), "d", sep = ""))

HTH, Thierry




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx_at_inbo.be
www.inbo.be

Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] Namens Ajay Shah
Verzonden: maandag 17 maart 2008 11:56
Aan: r-help
Onderwerp: [R] How does one do simple string concatenation?

How does one convert objects c("a","b","c") and "d" into "abcd"?

> paste(c("a","b","c"), "d")
of course yields

   [1] "a d" "b d" "c d"

-- 
Ajay Shah
http://www.mayin.org/ajayshah  
ajayshah_at_mayin.org
http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.

______________________________________________
R-help_at_r-project.org 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.

______________________________________________
R-help_at_r-project.org 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.
Received on Mon 17 Mar 2008 - 11:28:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Mar 2008 - 11:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive