visid: Visualizing Indicator Matrices and Missing Values

Description Usage Arguments Value Author(s) See Also Examples

View source: R/visid.R

Description

This function aggregates a binary dataframe or matrix using subtable and visualizes the combinations along with the marginal distributions using fluctile. Options include reordering of rows and columns, filtering the most important rows and columns aas well as ceiling censored zooming for the marginals.

Missing values can be visualized using is.na and datasets with categorical variables can be transoformed via idat. visna(x) is a shortcut for visid( is.na(x) + 0 ). visdf(x, freqvar) is a shortcut for visid( idat(x, allcat = TRUE, keep = freqvar) ).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
visid(x, freqvar = "Freq", tp = FALSE, fr = 1, fc = 1, sort = "n",
 sort.method = "count", col = "w",
  mar.col = c(alpha("black", 0.7), alpha("darkred", 0.8), "red", "green"),
   s = Inf, pmax = 1, opts = list(), plot = TRUE, return.data = !plot, ...)
visna(x, freqvar = "Freq", tp = FALSE, fr = 1, fc = 1, sort = "n",
 sort.method = "count", col = "w",
  mar.col = c(alpha("black", 0.7), alpha("darkred", 0.8), "red", "green"),
   s = Inf, pmax = 1, opts = list(), plot = TRUE, return.data = !plot, ...)
visdf(x, freqvar = "Freq", tp = FALSE, fr = 1, fc = 1, sort = "n",
 sort.method = "count", col = "w",
  mar.col = c(alpha("black", 0.7), alpha("darkred", 0.8), "red", "green"),
   s = Inf, pmax = 1, opts = list(), plot = TRUE, return.data = !plot, ...)

Arguments

x

A binary dataframe or matrix. is.na and idat can be used to bring in missing values and categorical variables.

freqvar

An optional frequency variable. If this is not found the data is aggregated usingsubtable.

tp

Logical. Whether or not to transpose the indicator matrix for the visualization.

fr

This controls the row filtering: Only the fr most frequent rows are kept. Values below 1 are interpreted as proportions and only the minmum number of rows covering at least fr percent of the observations are kept.

fc

See fr.

sort

One of "n" (no reordering), "r" (row reordering), "c" (column reordering) or "b" (row and column reordering).

sort.method

The default is reordering by frequency (rows) and average (columns). Other options include "ME" for reordering by the measure of effectiveness (see optME) and "optile" which enables all reorderings offered by optile.

col

The color palette. For the basic indicator case only a single color is meaningful. Transfrmations via idat feature coloring by variable.

mar.col

Colors for the marginals: rows, columns, row markers, column markers (see s and pmax).

s

Ceiling censored zooming for the rows. The maximum of the scale is s times the second largest value.

pmax

The maximum for the average/percentage scale used for the column marginal plot.

opts

A list of options. Currently:

gap.prop gaps proportion used in fluctile).
The default is to use no gaps if more than
40 rows or columns are involved.
mar Vector controlling the size of the marginal plots.
border Borders around the plot.
shape Shape of the symbols. Default is rectangles.
bg.col Background color center/right/bottom
abbrev Label abbreviation.
plot

Whether or not to draw the plot.

return.data

Whether or not to return the data after filtering and reordering took place.

...

Further arguments passed to either optME or optile. Can for instance be used to choose the reordering method.

Value

The filtered and reordered data or invisible(TRUE) (default).

Author(s)

Alexander Pilhoefer

See Also

fluctile, optile, idat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## Not run: 
require(reshape2)
require(scales)

MJ <- read.table(
"http://www.rosuda.org/~pilhoefer/MJnew.txt",
header=T,sep="\t",quote="")


MJS <- MJ[,13:105]

visid(MJS)

# sort by count/percentage
visid(MJS, sort="b")

# sort via ME
visid(MJS, sort = "b", sort.method="ME")

# only rows, only columns
visid(MJS, sort = "r", sort.method="ME")
visid(MJS, sort = "c", sort.method="ME")

# sort via optile
visid(MJS, sort = "b", sort.method="optile")

visid(MJS, sort = "b", sort.method="optile", iter=10)

visid(MJS, sort = "b", sort.method="optile",fun="ca")

# 24 rows
visid(MJS, sort = "r", sort.method="optile", fr=24)


# 24 rows, >= 40
visid(MJS, sort = "r", sort.method="optile", fr=24, fc = 0.4)


# zoom y marginal
visid(MJS, sort = "r", sort.method="optile", fr=24, s=1)


# zoom x marginal
visid(MJS, sort = "r", sort.method="optile", fr=24, pmax=0.1, s =0.5)


## End(Not run)

# NA-example: GeneEx

visna(GeneEx, sort = "b", sort.method="optile", fr=50, pmax=0.05, s = 2)

require(MASS)
visdf(housing)
visdf(housing,opts=list(var.col="w"))

visdf(housing,opts=list(var.col="w"), sort="r")

extracat documentation built on July 17, 2018, 5:05 p.m.

Related to visid in extracat...