redim.mx | R Documentation |
Re-dimension a matrix. Takes the matrix mx and transforms it into a length(newrows) x length(newcols) matrix which has the rows from mx specified in newrows and the cols from mx specified in newcols.
redim.mx(mx, newrows, newcols, dim.names)
mx |
source matrix |
newrows |
a vector specifing the rows from the source matrix that will appear in the new matrix. The new matrix will have length(newrows) rows. The position a source row will have in the new matrix is their index in newrows. A NA in this vector will create a row of NAs at the position in the new matrix. eg: c(2,NA,1) will create a new matrix of 3 rows. Row 1 of the new matrix will be row 2 of the source matrix Row 2 of the new matrix will be NAs. Row 3 of the new matrix will be row 1 of the source matrix. |
newcols |
a vector specifing the cols from the source matrix that will appear in the new matrix. Works in the same manner as newrows but for columns. |
dim.names |
A dimnames attribute for the matrix: NULL or a list of length 2 giving the row and column names respectively. An empty list is treated as NULL, and a list of length one as row names. The list can be named, and the list names will be used as names for the dimensions. |
a new matrix of length(newrows) rows and length(newcols) cols with the source rows and cols as specified by newrows and newcols. If the source matrix is a table then will also return a table.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.