tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Göran Broström
Sent: Tuesday, December 31, 2013 4:10 PM
To: r-help@R-project.org
Subject: Re: [R] seq_len and loops
Thanks for the answers from Duncan, Bill, Gabor, and Henrik. Y
h clauses make objects with the same names and types? I mildly prefer
avoiding
if statements because it makes reasoning about the results of the code more
complicated.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mail
.@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Duncan Murdoch
Sent: Saturday, December 21, 2013 3:52 PM
To: Göran Broström; R-help@r-project.org
Subject: Re: [R] seq_len and loops
On 13-12-21 6:50 PM, Duncan Murdoch wrote:
On 13-12-21 5:57 PM, Göran Broström wrote:
I was rec
-Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Duncan Murdoch
> Sent: Saturday, December 21, 2013 3:52 PM
> To: Göran Broström; R-help@r-project.org
> Subject: Re: [R] seq_len and loops
>
> On 13-12-21 6:50
What about
seq_len2 <- function(length.out, from=1L) {
seq(from=from, length.out=max(0L, length.out-from+1L))
}
> lapply(0:4, FUN=seq_len2, from=2L)
[[1]]
integer(0)
[[2]]
integer(0)
[[3]]
[1] 2
[[4]]
[1] 2 3
[[5]]
[1] 2 3 4
/Henrik
On Sat, Dec 21, 2013 at 2:57 PM, Göran Broström wrote:
> I
On 13-12-21 6:50 PM, Duncan Murdoch wrote:
On 13-12-21 5:57 PM, Göran Broström wrote:
I was recently reminded on this list that
"Using 1:ncol() is bad practice (seq_len is designed for that purpose)"
(Ripley)
This triggers the following question: What is "good practice" for
2:ncol(x)? (This is
On 13-12-21 5:57 PM, Göran Broström wrote:
I was recently reminded on this list that
"Using 1:ncol() is bad practice (seq_len is designed for that purpose)"
(Ripley)
This triggers the following question: What is "good practice" for
2:ncol(x)? (This is not a joke; in a recursive situation it oft
I was recently reminded on this list that
"Using 1:ncol() is bad practice (seq_len is designed for that purpose)"
(Ripley)
This triggers the following question: What is "good practice" for
2:ncol(x)? (This is not a joke; in a recursive situation it often makes
sense to perform the calculatio
Charilaos Skiadas wrote:
>
> On Dec 8, 2007, at 1:02 AM, Joe W. Byers wrote:
>
>> In a post on R-devel, Prof Ripley add the following comment
>> | > BTW, 1:dim(names)[1] is dangerous: it could be 1:0. That was the
>> | > motivation for seq_len.
>>
>> I use the dim(names)[1] and dim(x)[2] along wit
On Dec 8, 2007, at 1:02 AM, Joe W. Byers wrote:
> In a post on R-devel, Prof Ripley add the following comment
> | > BTW, 1:dim(names)[1] is dangerous: it could be 1:0. That was the
> | > motivation for seq_len.
>
> I use the dim(names)[1] and dim(x)[2] along with length(x) with
> varying
> lev
In a post on R-devel, Prof Ripley add the following comment
| > BTW, 1:dim(names)[1] is dangerous: it could be 1:0. That was the
| > motivation for seq_len.
I use the dim(names)[1] and dim(x)[2] along with length(x) with varying
levels of frustration depending on the object which I am trying to
11 matches
Mail list logo