Description Usage Arguments Details Value Author(s) See Also Examples

This function provides a fast and memory-efficient way to scale the rows and/or columns
of a dense or sparse matrix. Each row is multiplied with the corresponding element of
the vector `rows`

, each column with the corresponding element of the vector `cols`

.

1 | ```
scaleMargins(M, rows=NULL, cols=NULL, duplicate=TRUE)
``` |

`M` |
a dense or sparse matrix in canonical format |

`rows` |
a numeric vector with length equal to the number of rows of M, or a single number.
If missing or |

`cols` |
a numeric vector with length equal to the number of columns of M, or a single number.
If missing or |

`duplicate` |
if |

If `M`

is not in canonical format (dense numeric matrix or sparse matrix of class `dgCMatrix`

),
it will automatically be converted. In this case, the precise behaviour of `duplicate=FALSE`

is undefined.

`duplicate=FALSE`

is intended for internal use only.

The rescaled dense or sparse matrix.

Stefan Evert (http://purl.org/stefan.evert)

1 2 | ```
M <- matrix(1, 5, 3)
scaleMargins(M, rows=1:5, cols=c(1, 10, 100))
``` |

wordspace documentation built on May 30, 2017, 2:23 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.