Combine Challenges 1 and 3 from Practice: Arrays and Matrices.

  1. Create a 4×4 matrix m from the numbers 1 to 16, filled by row (look at the byrow argument of matrix()).
  2. Name the rows row1 to row4 and the columns col1 to col4 (look at dimnames).
  3. Print the whole matrix.
  4. Print the element in the 2nd row, 3rd column.
  5. Print only the 3rd row, then only the 4th column.

Print each part with print(), in that order. Press Run often: the matrix printout tells you immediately whether you filled it by row or by column.

You do not have permission to attempt this activity.