Learn R Programming

Radviz (version 0.9.3)

do.radviz: Projects a Matrix or a Data Frame to a 2D space defined by Dimensional Anchors

Description

do.radviz will return a projection of a multidimensional dataset onto a 2D space defined by dimensional anchors that have been projected on the unit circle using make.S

Usage

do.radviz(
  x,
  springs,
  trans = do.L,
  scaling = 1,
  label.color = "orangered4",
  label.size = NA,
  type = NULL,
  graph = NULL
)

Arguments

x

a data.frame or matrix to be projected, with column names matching row names in springs

springs

a matrix of 2D dimensional anchor coordinates, as returned by make.S

trans

a transformation to be applied to the data before projection

scaling

a scaling factor applied to data before the projection.

label.color

deprecated, use plot.radviz instead

label.size

deprecated, use plot.radviz instead

type

character string specifying the method used for obtaining the springs. Current methods are: Radviz, Freeviz and Graphviz. When not provided, type is derived from the other inputs

graph

igraph object (only relevant for result obtained from do.optimGraphviz analysis)

Value

an object of class radviz with the following slots:

  • proj: a ggplot2 object with a single geom_text layer corresponding to springs. the data slot of the ggplot2 corresponds to the input parameter x with the following extra columns:

    • rx and ry the X and Y coordinates of the radviz projection of x over springs

    • rvalid an index of points corresponding to an invalid projection (any rx or ry is NA)

  • springs: the matrix containing the spring coordinates.

  • type: character string specifying the method used for obtaining the springs.

  • trans: the function used to transform the data.

  • graphEdges: when the input graph is provided (for a Graphviz analysis), this slot will contain a dataframe with the graph edges

Details

The function expects that at least some of the column names in x will be matched by all row names in springs. The scaling factor can be used to increase the distance between points, making it useful in situations where all points are pulled together either because of similar values or large number of channels. The scaling is applied **after** the transformation by trans. The scaling idea is taken from [Artur & Minghim 2019](https://doi.org/10.1016/j.cag.2019.08.015).

Examples

Run this code
# NOT RUN {
data(iris)
das <- c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width')
S <- make.S(das)
rv <- do.radviz(iris,S)
summary(rv)
data(iris)
das <- c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width')
iris0 <- rbind(iris,c(rep(0,length(das)),NA))
S <- make.S(das)
rv0 <- do.radviz(iris0,S)

sum(!is.valid(rv0)) # should be 1

# to find which points where invalid in the data
which(!is.valid(rv0))

# to review the original data points
rv1 <- subset(rv0,is.valid(rv0))

summary(rv1)
# }

Run the code above in your browser using DataLab