Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

I googled for this once upon a time and nothing came up. Hopefully this saves someone ten minutes of digging about in the documentation.
You make identity matrices with the keyword diag, and the number of dimensions in parentheses.
> diag(3)
[,...

First, let us recall a standard result from linear algebra: "real symmetric matrices are diagonalizable by orthogonal matrices". Thus, any variance-covariance matrix can be written
since a variance-covariance matrix is also definite positive. In ...