[R] join chars in loops

jim holtman jholtman at gmail.com
Fri Apr 25 17:04:12 CEST 2008


for (i in 1:11){
    assign(paste('var', i, sep=''), value)
}

On Fri, Apr 25, 2008 at 10:40 AM, Dirkheld <dirk.bollen at soc.kuleuven.be> wrote:
>
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list