Thanks, we're almost there. The 3rd statement needs to
satisfy fi_2[r,c]<-fi_2[c,r] where rwrote:
> Try this:
>
> fi_2 <- diag(1, i)
> fi_2[lower.tri(fi_2)] <- 1 - runif(sum(lower.tri(fi_2))) ^ .5
> fi_2[upper.tri(fi_2)] <- fi_2[lower.tri(fi_2)]
>
> On Tue, Mar 15, 2011 at 7:51 PM, Brian Pellerin
Try this:
fi_2 <- diag(1, i)
fi_2[lower.tri(fi_2)] <- 1 - runif(sum(lower.tri(fi_2))) ^ .5
fi_2[upper.tri(fi_2)] <- fi_2[lower.tri(fi_2)]
On Tue, Mar 15, 2011 at 7:51 PM, Brian Pellerin <
brianpatrickpelle...@gmail.com> wrote:
> Hello R users,
>
> I would like to reduce the number of for loops i
Hello R users,
I would like to reduce the number of for loops in my code. I build these
matrices (5 times). The main diagonal are 1s and the two sides along the
main diagonal mirror each other as follows:
i<-5
fi<-matrix(0,nrow=i,ncol=i)#floral inhibition matrix for(r in 1:i){ for(c in
1:i){
3 matches
Mail list logo