do.radviz {Radviz} | R Documentation |
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 |
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 |
label.size |
deprecated, use |
type |
character string specifying the method used for obtaining the springs.
Current methods are: Radviz, Freeviz and Graphviz. When not provided, |
graph |
|
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).
Value
an object of class radviz with the following slots:
-
proj
: a ggplot2 object with a single geom_text layer corresponding to springs. thedata
slot of the ggplot2 corresponds to the input parameterx
with the following extra columns:-
rx
andry
the X and Y coordinates of the radviz projection ofx
oversprings
-
rvalid
an index of points corresponding to an invalid projection (anyrx
orry
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 inputgraph
is provided (for a Graphviz analysis), this slot will contain a dataframe with the graph edges
Author(s)
Yann Abraham
Examples
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)