order_matrix: Get the order of a matrix by columns, selecting some rows.

Description Usage Arguments Details Value Author(s) Examples

View source: R/order_matrix.R

Description

.. content for (no empty lines) ..

Usage

1
order_matrix(m, cols = 1L:ncol(m), rows = 1L:nrow(m))

Arguments

m

Matrix

cols

Positions or names of the columns to order.

rows

Integer vector with the rows to order.

Details

.. content for ..

Value

An integer vector with the order of the selected rows.

Author(s)

emilio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
m <- data.matrix(iris[,1:4])
m[2,1] <- NA
oom <- order_matrix(m,c("Sepal.Length","Sepal.Width"))
head(m[oom,])

rows <- 1:10
oom <- order_matrix(m,c("Sepal.Length","Sepal.Width"),rows)
m[rows,][oo,]

oom <- order_matrix(m,c("Sepal.Length","Sepal.Width"))
oo <- order(m[,"Sepal.Length"],m[,"Sepal.Width"],na.last=FALSE)
all.equal(oom,oo)

emiliotorres/preferelation documentation built on Dec. 20, 2021, 4:25 a.m.