Given a numeric matrix, this function performs a column-wise separation of positive values from negative values, producing a return matrix with twice the number of columns as the input matrix.
A numeric matrix
Conceptually, this function makes two copies of the input matrix (we will call
them A and B). It replaces all negative values in copy A with 0, and all positive
values in copy B with 0. It then multiplies copy B by -1, and finally combines (via
the two copies together column-wise. The strings "_pos" and "_neg" are appended to the
original column names to generate the column names for the new matrix.
A matrix devoid of negative values with twice the number of columns as the input matrix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.