multiSorting: Multidimensional Sorting/Ordering

Description Usage Arguments Details Value Note References See Also Examples

View source: R/multiSorting.R

Description

Performs a multidimensional sorting of a data.frame. One can choose between various approaches for the sorting, see the Details.

Usage

1
multiSorting(data, method = "identity", control = list())

Arguments

data

[data.frame]
data.frame where each row consists of one numeric data point vector.

method

[character(1)]
Method for sorting, see Details.

control

[list]
Further Arguments for the methods, see Details.

Details

The following methods for sorting are supported:

"identity"

order in the data set (i.e. the function does no further sorting).

"random"

a random order.

"norm"

ordering via a vector norm.

"median"

ordering via the median value per data point vector.

"dimSort"

sorting the data one-dimensional. Ties are broken by the next dimension and so on.

"weightedSum"

ordering the data via the value of a weighted sum per data point vector.

"projection"

projects the points of the data set orthogonal on a line.

"nonDomSort"

Nondominated Sorting. Ties can be broken via one of the other methods.

"convhull"

Computing repeatedly convex hulls for ordering the data.

"halfspace"

ordering according to the (approximate) values of Tukey's halfspace depth.

"clust"

Take the order gotten from a hierarchical clustering by hclust

"nn"

Nearest-Neighbor-Heuristic. Tries to find a shortest path trough the data by always taking the next nearest not-so-far-chosen point.

"shp"

Computes the Shortest Hamiltonian Path through the data.

The control argument is a list that can supply any of the following components:

degree [numeric(1)]

For method "norm":
Non-negative (possibly infinity) parameter of a vector-norm. Default: 2.

order [integer]

For method "dimSort":
Vector of dimension indices which determine the order of sorting. Default: 1:ncol(data).

weights [numeric]

For method "weightedSum":
Non-negative vector of length ncol(data) which give the weight for each dimension. Default: rep(1, ncol(data)).

vec.pos [numeric]

For method "projection":
Vector of length ncol(data) which gives the position vector of the line to project on. Default: rep(0, ncol(data)).

vec.dir [numeric]

For method "projection":
Vector of length ncol(data) which gives the direction vector of the line to project on. Default: rep(1, ncol(data)).

tie.breaking [character(1)]

For method "nonDomSort":
A character string determining one of the other methods for tie-breaking of the domination ranks. Default: "identity". Note, that if the chosen method has control arguments itsself, they can/should be also given via control.

clust.method [character(1)]

For method "clust":
The method-argument of hclust. Default: "complete".

dist.method [character(1)]

For method "clust", "nn" and "shp":
The method-argument of dist. Default: "euclidean".

p [numeric(1)]

For method "clust", "nn" and "shp":
The p-argument of dist. Default: 2.

path [character(1)]

For method "convhull", "halfspace" and "shp":
Path to the executable code of the Concorde solver. Default: The working directory.

prec [numeric(1)]

For method "shp":
The precision, i.e. the number of decimal places using for the distances between two points. Default: 6

.

Value

Named list with the entries:

sortedData [data.frame]

The sorted data.

inds [integer]

The sorted indices of the rows of the input data.

Note

The code of the Concorde TSP package is not included in this package and has to be obtained separately from the Concorde web site (see references). Either download the precompiled executables and place them in a suitable directory and make them executable, or you can get the source code and compile it on your own. TSP needs to know where the executables are.

References

See Also

plotMultiSorting

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
multiSorting(iris[, 1:4], method = "identity")
multiSorting(iris[, 1:4], method = "random")
multiSorting(iris[, 1:4], method = "norm")
multiSorting(iris[, 1:4], method = "median")
multiSorting(iris[, 1:4], method = "dimSort")
multiSorting(iris[, 1:4], method = "weightedSum")
multiSorting(iris[, 1:4], method = "projection")
multiSorting(iris[, 1:4], method = "nonDomSort")
multiSorting(iris[, 1:4], method = "convhull")
multiSorting(iris[, 1:4], method = "halfspace")
multiSorting(iris[, 1:4], method = "clust")
multiSorting(iris[, 1:4], method = "nn")
## Not run: multiSorting(iris[, 1:4], method = "shp")

melaniehorn/GSignTest documentation built on July 11, 2021, 1:18 a.m.