Type: Package
Title: Various Multivariate Graphics with Variable Choice in Shiny Apps
Version: 0.1.2
Date: 2021-11-08
Description: Mosaic diagram, scatterplot matrix, Andrews curves, parallel coordinate diagram, radar diagram, and Chernoff plots as a Shiny app, which allow the order of variables to be changed interactively. The apps are intended as teaching examples.
License: GPL-3
Encoding: UTF-8
Imports: MASS, fmsb, DescTools, shiny, shinydashboard, sortable
RoxygenNote: 7.1.1
NeedsCompilation: no
Packaged: 2021-11-08 12:07:36 UTC; sk
Author: Sigbert Klinke [aut, cre]
Maintainer: Sigbert Klinke <sigbert@hu-berlin.de>
Repository: CRAN
Date/Publication: 2021-11-09 08:10:02 UTC

andrews

Description

Andrews curves for visualization of multidimensional data. step determines the number of line segments for each curve. If ymax==NA then the maximum y coordinate will be determined from the curves. Note that for type==3 the x range is [0, 4*pi] otherwise [-pi, pi].

Usage

andrews(x, type = 1, step = 100, ..., normalize = 1, ymax = NA)

Arguments

x

data frame or matrix

type

type of curve (default: 1)

  • 1: f(t)=x1/(2^0.5)+x2*sin(t)+x3*cos(t)+x4*sin(2*t)+x5*cos(2*t)+...

  • 2: f(t)=x1*sin(t)+x2*cos(t)+x3*sin(2*t)+x4*cos(2*t)+...

  • 3: f(t)=x1*cos(t)+x2*cos((2*t)^0.5)+x3*cos((3*t)^0.5)+...

  • 4: f(t)=1/(2^0.5)*(x1+x2*(sin(t)+cos(t))+x3*(sin(t)-cos(t))+x4*(sin(2*t)+cos(2*t))+x5*(sin(2*t)-cos(2*t))+...)

step

smoothness of curves

...

further parameters given to graphics::plot and graphics::lines()

normalize

integer: normalization method (default: 1)

  • 0: no rescaling

  • 1: (x-min(x))/(max(x)-min(x))

  • 2: (x-mean(x))/sd(x)

ymax

numeric: maximum of y coordinate (default: NA)

Value

nothing

References

See Also

In package andrews or at CRAN

Examples

andrews(iris[,-5], col=as.factor(iris[,5]))
andrews(iris[,-5], type=4, col=as.factor(iris[,5]), ymax=2)

normalize

Description

Extracts the numeric vectors from a data frame and normalizes each vector.

Usage

normalize(x, method = 1)

Arguments

x

data.frame or matrix

method

integer: normalization method (default: 1)

  • 0: no rescaling

  • 1: (x-min(x))/(max(x)-min(x))

  • 2: (x-mean(x))/sd(x)

Value

numeric matrix

See Also

In package normalize or at CRAN

Examples

normalize(iris, 2)

order_andrews

Description

Returns a reording of the columns of x to visualize outliers or clusters better. If no colum names are given then V1, V2, ... will be used.

Usage

order_andrews(x, method = 1)

Arguments

x

data matrix

method

numeric: order method (default: 1)

  • 1: interquartile range

  • 2: max(x-median(x))/IQR(x) (outlier)

  • 3: fit to a Ward cluster solution with euclidean distance

Value

order of column vectors

Examples

order_andrews(iris)

order_parcoord

Description

Returns a reordering of the columns of x to visualize highly correlated variable pairs based on a cluster analysis of the correlation matrix. If no colum names are given then V1, V2, ... will be used.

Usage

order_parcoord(x, method = "spearman", ...)

Arguments

x

data matrix

method

numeric: order method (default: "spearman")

...

further parameters given to stats::cor()

Value

order of column vectors

Examples

order_parcoord(iris)

sandrews

Description

Shiny app for creating an Andrews curve diagram with interactive variable selection.

Usage

sandrews(data, xvar = character(0), ...)

Arguments

data

matrix or data.frame

xvar

character: names of selected variables for the plot

...

further parameters given to andrews()

Value

nothing

Examples

if (interactive()) sandrews(iris)

schernoff

Description

Shiny app for creating a Chernoff faces plot with interactive variable selection.

Usage

schernoff(data, xvar = character(0), ...)

Arguments

data

matrix or data.frame

xvar

character: names of selected variables for the plot

...

further parameters given to DescTools::PlotFaces()

Value

nothing

Examples

if (interactive()) schernoff(normalize(iris))

smosaic

Description

Shiny app for creating a Mosaic plot with interactive variable selection.

Usage

smosaic(data, xvar = character(0), yvar = character(0), ...)

Arguments

data

table or data.frame

xvar

character: names of selected variables for x-axis

yvar

character: names of selected variables for y-axis

...

further parameters given to graphics::mosaicplot()

Value

nothing

Examples

if (interactive()) smosaic(Titanic)
dfTitanic <- table2dataframe(Titanic)
if (interactive()) smosaic(dfTitanic)

spairs

Description

Shiny app for creating a scatterplot matrix with interactive variable selection.

Usage

spairs(data, xvar = character(0), ...)

Arguments

data

matrix or data.frame

xvar

character: names of selected variables for the plot

...

further parameters given to graphics::pairs()

Value

nothing

Examples

if (interactive()) spairs(iris, col=as.factor(iris$Species))

sandrews

Description

Shiny app for creating a Parallel Coordinate plot with interactive variable selection.

Usage

sparcoord(data, xvar = character(0), ...)

Arguments

data

matrix or data.frame

xvar

character: names of selected variables for the plot

...

further parameters given to MASS::parcoord()

Value

nothing

Examples

if (interactive()) sparcoord(iris, col=as.factor(iris$Species))

sradar

Description

Shiny app for creating radar charts with interactive variable selection.

Usage

sradar(data, xvar = character(0), ...)

Arguments

data

matrix or data.frame

xvar

character: names of selected variables for the plot

...

further parameters given to fmsb::radarchart()

Value

nothing

Examples

if (interactive()) sradar(normalize(iris))

table2dataframe

Description

Converts a table to a full data frame.

Usage

table2dataframe(tab, ...)

Arguments

tab

table: contingency table

...

further parameters given to base::as.data.frame.table()

Value

a data frame with sum(tab) rows and length(dim(tab)) cols

Examples

table2dataframe(Titanic)

mirror server hosted at Truenetwork, Russian Federation.