Skip to content

Commit

Permalink
mat1 -> matrix1
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickwurm authored Oct 14, 2024
1 parent 0e5e10d commit 195baf9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 2021/practical0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ As with vectors, you can get to the elements of a matrix using square brackets,
* `matrix1[seq_len(length.out = 2), seq_len(length.out = 2)]`
* `matrix1[seq_len(length.out = 2), ]`

#### Q14. How do you retrieve the 2nd column of `mat2`?
#### Q14. How do you retrieve the 2nd column of `matrix2`?

You can perform simple calculations on matrices, in which case the calculation applies to each element separately:

Expand Down Expand Up @@ -234,12 +234,12 @@ Keep in mind that if you ever need help in understanding a function, just bring
#### Q15. The variable `matrix1` describes a matrix produced by the following code:

```R
mat1 <- matrix(data = seq_len(length.out = 50), nrow = 10, ncol = 5)
matrix1 <- matrix(data = seq_len(length.out = 50), nrow = 10, ncol = 5)
```

What number would we expect to see when we evaluate `matrix1[1, 2]`? Try to answer this without evaluating the code! Why not a different number?

#### Q16. Which of these commands would output the 2nd and 4th columns of mat1 only (again, try answering this without evaluating the code!)?
#### Q16. Which of these commands would output the 2nd and 4th columns of matrix1 only (again, try answering this without evaluating the code!)?

```R
matrix1[2, 4]
Expand Down

0 comments on commit 195baf9

Please sign in to comment.