[R] how to create many objects with sequencial names?

Wensui Liu liuwensui at gmail.com
Sun Aug 27 04:37:12 CEST 2006


Hi, Jim,

It is you again. I couldn't remember how many times you answered my
silly questions. ^_^

I am not sure assign() is what I want. Say, if I want to create 1000
linear model objects with names lm1, lm2....lm1000, it seems assign
can't solve it.

But your second solution is close to what I am looking for.

Any idea?

Thanks.

wesui
On 8/26/06, jim holtman <jholtman at gmail.com> wrote:
> Yes there is with statements like:
>
> assign(paste('m', i, sep='', value)
>
> But I would suggest that you put the values in a list to make it
> easier to access since all the data is in a single object.  You could
> do it in a loop:
>
> result <- list()
> for(i in 1:100){
>     ......computation.....
>     result[[i]] <- yourResult
> }
>
>
> On 8/26/06, Wensui Liu <liuwensui at gmail.com> wrote:
> > Dear Lister,
> >
> > Is there a way to create many objects with sequencial names, say lm1,
> > lm2...lm100?
> >
> > Thanks.
> >
> > ______________________________________________
> > 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
> > 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?
>


-- 
WenSui Liu
(http://spaces.msn.com/statcompute/blog)
Senior Decision Support Analyst
Health Policy and Clinical Effectiveness
Cincinnati Children Hospital Medical Center



More information about the R-help mailing list