> "Richard" == Richard A O'Keefe <[EMAIL PROTECTED]>
> on Fri, 3 Dec 2004 14:53:04 +1300 (NZDT) writes:
Richard> I wrote about the perennial "assign to V1 ... Vn" problem:
>> >What I want to know is *WHY* people are doing this?
Richard> I failed to make myself clear.
I wrote about the perennial "assign to V1 ... Vn" problem:
> >What I want to know is *WHY* people are doing this?
I failed to make myself clear.
What I meant was "what happens NEXT? Once someone has got past the
stage of generating V1 ... V100 (or whatever the magic number is),
what do t
[EMAIL PROTECTED] (Bjørn-Helge Mevik) writes:
> Peter Dalgaard writes:
>
> > There are irregularities, e.g. the fact that you do help(foo), not
> > help("foo"), but they tend to get a pain in the long run (How do you
> > get help on a name contained in a variable?
>
> v <- "lm"; help(v)
> works
Peter Dalgaard writes:
> There are irregularities, e.g. the fact that you do help(foo), not
> help("foo"), but they tend to get a pain in the long run (How do you
> get help on a name contained in a variable?
v <- "lm"; help(v)
works for me :-)
(But I totally agree that the regularity of R (or S
Tiago R Magalhaes wrote:
For loops are conceptually very easy to understand. Lists are not
easy to understand (why list[[1]] instead of list[1]? it's not
completely intuitive) .
I try to explain it as comparable to the difference between a subset
that consists of one element (the "[" function al
Kjetil Brinchmann Halvorsen <[EMAIL PROTECTED]> writes:
> >This is, of course, a FAQ. It's such a FAQ that I must have seen it
> >once a day for the last several days.
> >
> >What I want to know is *WHY* people are doing this?
> >
> Bad habits from less expressive languages?
Actually, from less
Richard A. O'Keefe wrote:
Tobias Muhlhofer <[EMAIL PROTECTED]> wrote:
I am trying to define a large number of variables through a loop
construct.
He wants to do
for (i in 1:100) {
assign(paste("v", i, sep=""), something or other...)
}
This is
Very interesting topic. "What I want to know is *WHY* people are doing this?"
Here goes my view - I've used many for loops, and each time I realize
how stupid that is... AFTER I learned how to avoid it. But it's
difficult to avoid them without knowing how to do it. (Monsieur de
LaPalice wouldn'
Richard A. O'Keefe wrote:
Tobias Muhlhofer <[EMAIL PROTECTED]> wrote:
I am trying to define a large number of variables through a loop
construct.
He wants to do
for (i in 1:100) {
assign(paste("v", i, sep=""), something or other...)
}
This is
Tobias Muhlhofer <[EMAIL PROTECTED]> wrote:
I am trying to define a large number of variables through a loop
construct.
He wants to do
for (i in 1:100) {
assign(paste("v", i, sep=""), something or other...)
}
This is, of course, a FAQ. It's
Tobias Muhlhofer <[EMAIL PROTECTED]> writes:
> I am trying to define a large number of variables through a loop construct.
>
> I have my loop variable i being cycled through 1:100 and I would like
> the variables produced by this to be called
>
> vi (i.e. v1 v2 v3 etc)
>
> so, for example I'm g
see ?assign and ?get
i,e instead ob below have something like assign(paste("v", i,
sep=""), a[i:N])
and if you need to loop over calling them say get(paste("v", i, sep=""))
of course typing v1 will call the variable...
Jean
On Tue, 30 Nov 2004, Tobias Muhlhofer wrote:
> I am trying to defin
See the R-FAQ here:
http://cran.r-project.org/doc/FAQ/R-FAQ.html
Number 7.21.
However, as the FAQ also points out, you might be better served using
lists.
a <- list()
for (i in 1:100) {
a[[i]] <- some stuff
}
Sean
On Nov 30, 2004, at 5:42 PM, Tobias Muhlhofer wrote:
I am trying to define a lar
On Tue, 30 Nov 2004, Tobias Muhlhofer wrote:
I am trying to define a large number of variables through a loop construct.
I have my loop variable i being cycled through 1:100 and I would like the
variables produced by this to be called
vi (i.e. v1 v2 v3 etc)
Look at FAQ 7.21, which explains how to
I am trying to define a large number of variables through a loop construct.
I have my loop variable i being cycled through 1:100 and I would like
the variables produced by this to be called
vi (i.e. v1 v2 v3 etc)
so, for example I'm going:
for(i in 1:100) {
<- a[i:N] # or whatever else you want
15 matches
Mail list logo