Panos Hadjinicolaou
2010-Jul-26 13:44 UTC
[R] Concatenate a mix of numbers and letters to create a vector name
Dear all, I am trying to create a vector name, for example tmax.195012 from tmax., 1950 and 12. Obviously I don't wish to simply type it because the 3 name components are changing in each iteration within a loop. Is there any way of concatenating those 3 components (which are a mixture of numbers and letters)? Thanks for reading, Panos ----------------------------------------------------------------- Dr Panos Hadjinicolaou Energy Environment & Water Research Center (EEWRC) The Cyprus Institute ------------------------------------------------------------------ [[alternative HTML version deleted]]
Dimitris Rizopoulos
2010-Jul-26 13:48 UTC
[R] Concatenate a mix of numbers and letters to create a vector name
have a look at function paste(), i.e., ?paste I hope it helps. Best, Dimitris On 7/26/2010 3:44 PM, Panos Hadjinicolaou wrote:> Dear all, > > I am trying to create a vector name, for example tmax.195012 from tmax., 1950 and 12. Obviously I don't wish to simply type it because the 3 name components are changing in each iteration within a loop. Is there any way of concatenating those 3 components (which are a mixture of numbers and letters)? > > Thanks for reading, > > Panos > > ----------------------------------------------------------------- > Dr Panos Hadjinicolaou > > Energy Environment& Water Research Center (EEWRC) > The Cyprus Institute > ------------------------------------------------------------------ > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014
Panos Hadjinicolaou
2010-Jul-26 14:23 UTC
[R] Concatenate a mix of numbers and letters to create a vector name
Thanks for the reply. Indeed the paste function results in concatenation: > paste(c("tmax.", 1950, 12), collapse="") [1] "tmax.195012" but I am looking for a way to subsequently get rid of the - " - in order to use tmax.195012 as an object (e.g. to define a vector with that name). Any ideas? Thanks, Panos _____ From: Dimitris Rizopoulos [mailto:d.rizopoulos@erasmusmc.nl] To: Panos Hadjinicolaou [mailto:p.hadjinicolaou@cyi.ac.cy] Cc: r-help@r-project.org Sent: Mon, 26 Jul 2010 16:48:31 +0300 Subject: Re: [R] Concatenate a mix of numbers and letters to create a vector name have a look at function paste(), i.e., ?paste I hope it helps. Best, Dimitris On 7/26/2010 3:44 PM, Panos Hadjinicolaou wrote: > Dear all, > > I am trying to create a vector name, for example tmax.195012 from tmax., 1950 and 12. Obviously I don't wish to simply type it because the 3 name components are changing in each iteration within a loop. Is there any way of concatenating those 3 components (which are a mixture of numbers and letters)? > > Thanks for reading, > > Panos > > ----------------------------------------------------------------- > Dr Panos Hadjinicolaou > > Energy Environment& Water Research Center (EEWRC) > The Cyprus Institute > ------------------------------------------------------------------ > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 [[alternative HTML version deleted]]