Matrix-matrix-2018 June 9
Today is a pity, not too much to learn R language (mainly because to listen to party lecture, learned the party important speech, so no reading), so today summed up a matrix bar. But more study.
First of all, a little review of yesterday's factor, the first thing to remember is mode () look at each element, class () see what is the whole, and if you put true ABC 1 to a vector, the vector will convert it to type. Security: String > Numeric > logical value. Will try to convert to a high level of security. This is an implicit type conversion. Of course, you can also use the as family for type conversions, such as converting numbers to strings: As.character () (can be remembered as Char+acter)
Next, The Matrix
A matrix is an extension of an object's amount, a vector is a one-dimensional structure, and a matrix is a two-dimensional structure, and all element types must be the same.
1: How to create a matrix
Matrix ()
You can also make changes to the vector Dim property
You can also assemble a number of vectors into a matrix, or you can synthesize a matrix of matrices: matrix, and matrices can add row names and column names to make it easier for us to find the data without having to count the number of rows he is in the first row. (Of course you want to use which to find me and don't talk!) )
First, if you learn linear algebra, it is easy to understand what the matrix is, such as the decomposition of the matrix, like to multiply and so on in R.
So formally, create the matrix:
(1), Create Na matrix (review na for missing values)
(2), create a worthy
Priority by line
(3) Assembly
、
Look at mode and class.
R language data structure--2 matrix and data frame ① matrix-matrix