[R] Using seq_len() vs 1:n]

Peter Ehlers ehlers at ucalgary.ca
Fri Feb 12 12:47:38 CET 2010


Pat Burns makes a good point. -Peter

-------- Original Message --------
Subject: Re: [R] Using seq_len() vs 1:n
Date: Fri, 12 Feb 2010 09:01:20 +0000
From: Patrick Burns <pburns at pburns.seanet.com>
To: Peter Ehlers <ehlers at ucalgary.ca>
References: <4B746AEF.10900 at ucalgary.ca>

If you want your code to be compatible with
S+, then 'seq_len' isn't going to work.

On 11/02/2010 20:39, Peter Ehlers wrote:
> R-people,
>
> Duncan Murdoch's response in
>
> https://stat.ethz.ch/pipermail/r-help/2010-February/227869.html
>
> reminded me of something I had been meaning to ask.
>
> A while ago I started using
>
> for(i in seq_len(v)) {....}
>
> in preference to
>
> for(i in 1:n) {....}
>
> Duncan's post shows that if n can be zero, there is
> an advantage to using seq_len.
> Is there ever a *dis*advantage?
>
> Peter Ehlers
> University of Calgary
>
> ______________________________________________
> 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.
>

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'The R Inferno' and 'A Guide for the Unwilling S User')

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list