On 4/12/06, Paul Roebuck <[EMAIL PROTECTED]> wrote:
> > I want to do a for loop in which m takes on the values
> > 1, 5, 10, 15, 20.  What is the syntax for doing that?
> >
> > I had been doing a loop for m in 1:20, but I only want
> > those values above.
>
> ?seq

... which doesn't handle the 1 in that sequence very elegantly.  You can do this

for (m in c(1, seq(5, 20, 5)))

   for the general case, but for the specific circumstance I'd do

for (m in c(1, 5, 10, 15, 20))

-- Chris

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to