t; So is it possible to try something like that:
>
> for (i in 1:10) for (j in 1:10)
> assign(paste("var",i,j,sep=""),myfunction)
>
>
>
> I would like to thank you in advance for your help
>
> best Regards
> Alexandros
> --- On Thu, 2/3/11,
, function(fit) coef(fit)[1] )
hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf
like to thank you in advance for your help
best Regards
Alexandros
--- On Thu, 2/3/11, Eik Vettorazzi wrote:
> From: Eik Vettorazzi
> Subject: Re: [R] looping variable names
> To: "hypermonkey22"
> Cc: r-help@r-project.org
> Date: Thursday, February 3, 2011
As Greg wrote, a list is in most circumstances a better way to store
many objects.
But you can use 'assign' and 'get' to create and access (global) variables
#creation
for (i in 1:100) assign(paste("var",i,sep=""),rnorm(5))
#access i-th variable
i<-15
get(paste("var",i,sep=""))
hth.
Am 02.02.20
Hi
r-help-boun...@r-project.org napsal dne 03.02.2011 00:56:40:
>
> Thanks for the reply!
>
> This sounds great. Is there a nice way to store these 100 variable names
in
> a list without typing them all out?
Why? When you need your 42nd variable from a list lll you can just use
lll[42]
and
Thanks for the reply!
This sounds great. Is there a nice way to store these 100 variable names in
a list without typing them all out?
--
View this message in context:
http://r.789695.n4.nabble.com/looping-variable-names-tp3255711p3256356.html
Sent from the R help mailing list archive at Nabble.
t: Wednesday, February 02, 2011 1:37 PM
> To: r-help@r-project.org
> Subject: [R] looping variable names
>
>
> Hi all,
>
> I've been looking for a simple answer to the following problem.
>
> Let's say that I can loop through, say, 100 values that need to b
Hi all,
I've been looking for a simple answer to the following problem.
Let's say that I can loop through, say, 100 values that need to be assigned
to, say, the variables var1:var100.
Is there an elegant way to do this?
I have seen one or two similar questions...but they tend to be in more
com
8 matches
Mail list logo