> "PD" == Peter Dalgaard <[EMAIL PROTECTED]>
> on Sat, 22 Dec 2007 11:29:30 +0100 writes:
PD> Chris Stubben wrote:
>> Also try the odiag function in the demogR package
>>
>> odiag( 1:5, -1)
>> [,1] [,2] [,3] [,4] [,5] [,6]
>> [1,]000000
Chris Stubben wrote:
> Also try the odiag function in the demogR package
>
> odiag( 1:5, -1)
> [,1] [,2] [,3] [,4] [,5] [,6]
> [1,]000000
> [2,]100000
> [3,]020000
> [4,]003000
> [5,]000
Also try the odiag function in the demogR package
odiag( 1:5, -1)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]000000
[2,]100000
[3,]020000
[4,]003000
[5,]000400
[6,]000
On Dec 21, 2007 3:58 PM, Jonas Malmros <[EMAIL PROTECTED]> wrote:
> I wonder if there is a function in R with which I can create a square
> matrix with elements off main diagonal (for example one diagonal below
> the main diagonal).
Try this and adjust the formula for other patterns:
> mm <- matr
Jonas Malmros wrote:
> Hi, everyone
>
> I wonder if there is a function in R with which I can create a square
> matrix with elements off main diagonal (for example one diagonal below
> the main diagonal).
>
> Thanks in advance!
>
>
You could combine rbind, diag and cbind:
rbind(rep(0,3),cbind(d
Hi, everyone
I wonder if there is a function in R with which I can create a square
matrix with elements off main diagonal (for example one diagonal below
the main diagonal).
Thanks in advance!
--
Jonas Malmros
Stockholm University
Stockholm, Sweden
_
6 matches
Mail list logo