Hi:
Try this:
> z <- matrix(rnorm(100), nrow = 10)
> sum(sapply(seq_len(nrow(z)), function(k) det(z[-k, -k])))
[1] 1421.06
where
> sapply(seq_len(nrow(z)), function(k) det(z[-k, -k]))
[1] 432.11613 81.65449 516.95791 54.72775 804.32097 -643.35436
[7] -411.15932 394.18780 84.13173 10
Dear R-help list,
Pls I have this problem. Suppose I have a matrix of size nxn say, generated as
follows
z<-matrix(rnorm(n*n,0,1),nrow=n)
I want to write a function such that for i in 1:n, I will remove the rows and
columns
corresponding to i (so, will be left with n-1*n-1 submatrix in each
2 matches
Mail list logo