[R] join chars in loops
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Fri Apr 25 17:07:22 CEST 2008
look at ?assign(), e.g.,
for (i in 1:11) {
assign(paste("var", i, sep = ""), i)
}
var1
var2
var10
but I'd prefer to use a list. I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Dirkheld" <dirk.bollen at soc.kuleuven.be>
To: <r-help at r-project.org>
Sent: Friday, April 25, 2008 4:40 PM
Subject: [R] join chars in loops
>
> Hi,
>
> Is it possible to create new vars in a loop
>
> For instance:
>
> for (i in 1:11)
> var'i' <- assign something
>
> output =
> var1
> var2
> ...
> var11
>
> Is there a way to combine/join the value of 'i' to the string/char
> var in de
> loop.
>
> --
> View this message in context:
> http://www.nabble.com/join-chars-in-loops-tp16895854p16895854.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list