Code:

```
M<-cor(mtcars)
head(round(M,2))
```

- Thread starter hlsmith
- Start date

Code:

```
M<-cor(mtcars)
head(round(M,2))
```

Code:

```
v <- c(2,0,0,0,0,0,
0,1,0,0,0,0,
0,0,5,0,0,0,
0,0,0,6,0,0,
0,0,0,0,9,0,
0,0,0,0,0,7)
v
vv <- matrix(v,nrow=6, ncol=6)
vv
colnames(vv) <- c("EPA1", "EPA2", "EPA3", "EPA4", "EPA5", "EPA6")
rownames(vv) <- c("EPA1", "EPA2", "EPA3", "EPA4", "EPA5", "EPA6")
vv
```

Thanks.

Code:

```
vv <- matrix(0, nrow=6, ncol=6,
dimnames = lapply(1:2, function(i) c("EPA1", "EPA2", "EPA3", "EPA4", "EPA5", "EPA6"))
)
diag(vv) <- c(2, 1, 5, 6, 9, 7)
vv
## EPA1 EPA2 EPA3 EPA4 EPA5 EPA6
## EPA1 2 0 0 0 0 0
## EPA2 0 1 0 0 0 0
## EPA3 0 0 5 0 0 0
## EPA4 0 0 0 6 0 0
## EPA5 0 0 0 0 9 0
## EPA6 0 0 0 0 0 7
```