Skip to content

Commit

Permalink
Update cor.R
Browse files Browse the repository at this point in the history
  • Loading branch information
elinw authored Dec 16, 2023
1 parent 2cd40fc commit 2424c02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/library/stats/R/cor.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ cov2cor <- function(V)
r <- V # keep dimnames
r[] <- Is * V * rep(Is, each = p)
## == D %*% V %*% D where D = diag(Is)
r[cbind(1L:p,1L:p)] <- 1 # exact in diagonal
if(p) r[seq.int(from = 1L, by = p + 1, length.out = p)] <- 1 # exact in diagonal
r
}

0 comments on commit 2424c02

Please sign in to comment.