
A matrix is just for either numeric or character elements. If one or more elements in the matrix represent characters, all other elements are also converted to characters. Is.matrix(mat3b) # TRUE mat3b # vec1 vec2 Make a matrix from both vec1 and vec2 with 6 rows and 2 columns.Vec1 and mat1 contain numbers and vec2 and mat2 contain characters. For a matrix we need to specify the dimensions (in this case 3 rows and 2 columns) and the input (in this case vec1 or vec2) needs to match these dimensions. The dimensions for both matrices are 3 rows by 2 columns.

Create two matrices, one from vec1 and one from vec2.It is just a series of numbers or letters. To create a vector we used c(), which stands for ‘concatenation’. Make two vectors: one named vec1 with values 1 through 6 and one named vec2 with letters A through F.
