Description Usage Arguments Details Value Examples
View source: R/remove-duplicate.R
remove_duplicate()
removes duplicate columns from sparse and dense
matrices.
1 2 3 4 5 6 7 | remove_duplicate(x)
## S3 method for class 'CsparseMatrix'
remove_duplicate(x)
## S3 method for class 'matrix'
remove_duplicate(x)
|
x |
A |
remove_duplicate()
is an S3 generic with methods for:
CsparseMatrix
matrix
x
with duplicate columns removed.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Create a sparse matrix with duplicated columns
x <- Matrix::rsparsematrix(10, 4, 0.1)
colnames(x) <- paste0("x", 1:4)
x <- cbind(x, x[, c(1, 4)])
# Print x
x
# Same matrix in dense format
xdense <- as.matrix(x)
# Drop duplicate columns
remove_duplicate(x)
remove_duplicate(xdense)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.