sdf_sort: Reordering a list of class "sdfdata"

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

View source: R/sdf_sort.R

Description

The function reorders a list of class "sdfdata" for displaying scagnostics results in scaggrams. The reordering algorithm is based on distances between "direct" neighbors. See Details.

Usage

1
sdf_sort(sdfdata, maxt = NULL, select = "All", printmsum = FALSE)

Arguments

sdfdata

A list of class "sdfdata".

maxt

NULL or a positive integer giving a time limit. Default is NULL (no time limit).

select

"All" or a vector of integers or strings giving the scagnostics which should be used for reordering.

printmsum

logical. Should the optimality criterion be printed after each iteration? Default is FALSE.

Details

The implemented algorithm to reorder the "sdfdata" list is greedy. In each iteration all variable changes of exactly two variables are considered, that means associated rows and columns within the scaggram are switched. The (p choose 2) different orders are compared by msum. The goal is to minimize msum, which is defined as the sum of distances of all row-wise and all column-wise neighbors. The algorithm stops if no improvement is possible by changing two arbitrary variables or the specified time limit is exceeded.

Value

A list of class "sdfdata".

Author(s)

Katrin Grimm

See Also

sdf, scag2sdf, sdf_quicksort, scaggram, iascaggram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(Election2005)
# consider only demographic/economic information
election05_ds <- Election2005[,1:40]
## Not run: 
scagdf <- sdf(election05_ds)
# ordering based on all scagnostics from sdf
scagdf_o2 <- sdf_sort(scagdf)
# compare scaggrams
par(mfrow=c(1,2))
scaggram(scagdf,select=(c(1,5,9)))
scaggram(scagdf_o2,select=(c(1,5,9)))

## End(Not run)

mbgraphic documentation built on May 2, 2019, 2:45 a.m.