Re: [R] "diag", "diag<-" and "[" , "[<-"

2010-01-07 Thread Duncan Murdoch
On 07/01/2010 9:31 AM, berga...@gmail.com wrote: Dear all I have the following problem. M <- matrix(0,3,3) # dimension of M is dinamic and this can lead to the next subscript diag(M[1,1]) <- rep(100,1) #Error in `diag<-`(`*tmp*`, value = 100) : # only matrix diagonals can be replaced diag(M

[R] "diag", "diag<-" and "[" , "[<-"

2010-01-07 Thread bergarog
Dear all I have the following problem. M <- matrix(0,3,3) # dimension of M is dinamic and this can lead to the next subscript diag(M[1,1]) <- rep(100,1) #Error in `diag<-`(`*tmp*`, value = 100) : # only matrix diagonals can be replaced diag(M[1,1,drop=F]) <- rep(100,1) #Error in diag(M[1, 1, d