  ### B.5 Size information, reshaping/replicating & cleaning

The following statements are used to provide information on the dimensions of matrices or the number of observations or variables in a dataset, to reshape or replicate matrices, and to drop rows or columns with missing data from a matrix or dataset.

 Syntax Arguments and performed function S = size(X); S is a $2\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ matrix of integers. The ﬁrst entry of S is the number of rows of X and the second entry is the number of columns of X. X must be a matrix or dataset p = rows(X); p is a $1\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ matrix equal to the number of rows of X. X must be a matrix or dataset p = cols(X); p is a $1\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ matrix equal to the number of columns of X. X must be a matrix or dataset W = kron(X, Y); W is a matrix obtained as the Kronecker product of X, and Y. X must be a matrix or dataset Y must be a matrix or dataset W = repmat(X, M, N); W is a matrix obtained by replicating X, M times along the row dimension and N times along the column dimension. X must be a matrix or dataset M must be a positive integer N must be a positive integer W = reshape(X, M, N); W isan M$×$N matrix constructed by reading the entries of X, in a column-major order. X must be a matrix or dataset M must be a positive integer N must be a positive integer If the number of entries of X is not M$\cdot$N an error is produced W = dropmissing(X); W is a matrix constructed by reading the entries of X, row by row, but skipping any rows in X that contain at least one missing value. An error is produced if an empty matrix results from dropping the rows of X with missing values. X must be a matrix or dataset When the argument provided to dropmissing() is a dataset, then the function returns a dataset. Therefore, this function is also documented in Section B.13. see also dropif and keepif

Share this content:    © 2016–20 Grigorios Emvalomatis