When a single column is extracted from a multicolumn matrix, R often strips the matrix formatting. This generally causes my code to crash, because I assume that the formatting is preserved. This function aims to preserve that formatting. Testing note: Tested with an input matrix with 5 columns & 4 rows, and subset to obtain 0, 1 and 2 columns.
1 | matrix.subset(in.mat, index.var, target.value)
|
in.mat |
The input matrix |
index.var |
The variable to be used for subsetting |
target.value |
The value of the subsetting variable to subset on. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.