What does
print(as.integer(branches))
give? That is what rep() uses.
/H
On Thu, Feb 18, 2010 at 7:49 PM, dkStevens wrote:
>
> I could send the entire bit of code but I was hoping that someone would
> recognize the issue from past experience. I may be an artifact of other
> parts of the code.
I could send the entire bit of code but I was hoping that someone would
recognize the issue from past experience. I may be an artifact of other
parts of the code. I observed the problem in a larger context and cut
out all that you see below. The comments were next to the results to
clarify. Ap
That's what I did. 'branches' was shown at the top.
branches = c(5,6,5,5,5)
I tested this. When I copy and paste into R 10.0 I get the result in the
post. Perhaps I should reinstall R. I guess I don't see how much more
narrow I can get than this.
i iInd = 1
for(i in 1:length(branches)
On Thu, Feb 18, 2010 at 7:15 PM, Erik Iverson wrote:
>
>
> Erik Iverson wrote:
>>
>> Cannot reproduce, what is branches? If you can narrow it down to a
>> "commented, minimal, self-contained, reproducible" example, you're far more
>> likely to get help from the list.
>>
>
> My blinded guess thoug
Sorry, not reproducible. This works for me (as expected):
branches<-c(5,6)
iInd = 1
for(i in 1:length(branches)) {
print((1:branches[i])+iInd-1) # iInd is a position shift of the index
ni = branches[i]
print(i)
print(ni)
print(c(ni,rep(i,times=ni)))
# ... some interesting other
Erik Iverson wrote:
Cannot reproduce, what is branches? If you can narrow it down to a
"commented, minimal, self-contained, reproducible" example, you're far
more likely to get help from the list.
My blinded guess though, is something to do with FAQ 7.31.
Cannot reproduce, what is branches? If you can narrow it down to a
"commented, minimal, self-contained, reproducible" example, you're far
more likely to get help from the list.
dkStevens wrote:
I'm observing odd behavior of the rep(...) procedure when using variables as
parameters in a loop.
I'm observing odd behavior of the rep(...) procedure when using variables as
parameters in a loop. Here's a simple loop on a vector 'branches' that is
c(5,6,5,5,5). The statement in question is
print(c(ni,rep(i,times=ni)))
that works properly first time through the loop but the second
8 matches
Mail list logo