Package 'explor'

Title: Interactive Interfaces for Results Exploration
Description: Shiny interfaces and graphical functions for multivariate analysis results exploration.
Authors: Julien Barnier [aut, cre]
Maintainer: Julien Barnier <[email protected]>
License: GPL (>= 3)
Version: 0.3.10.9000
Built: 2024-11-01 05:56:13 UTC
Source: https://github.com/juba/explor

Help Index


Interactive CA variables plot

Description

This function generates an HTML widget displaying the variables plot of a CA result.

Usage

CA_var_plot(
  res,
  xax = 1,
  yax = 2,
  lev_sup = TRUE,
  var_sup = TRUE,
  var_sup_choice = NULL,
  var_hide = "None",
  var_lab_min_contrib = 0,
  point_size = 64,
  col_var = NULL,
  symbol_var = NULL,
  size_var = NULL,
  size_range = c(10, 300),
  zoom_callback = NULL,
  in_explor = FALSE,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

lev_sup

TRUE to display supplementary levels

var_sup

TRUE to display supplementary variables

var_sup_choice

list of supplementary variables to display

var_hide

elements to hide (rows or columns)

var_lab_min_contrib

Contribution threshold to display points labels

point_size

base point size

col_var

name of the variable for points color

symbol_var

name of the variable for points symbol

size_var

name of the variable for points size

size_range

points size range with format c(minimum, maximum)

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

...

Other arguments passed to scatterD3


Interface for analysis results exploration

Description

This function launches a shiny app in a web browser in order to do interactive visualisation and exploration of an analysis results.

Usage

explor(obj)

## S3 method for class 'CA'
explor(obj)

## S3 method for class 'textmodel_ca'
explor(obj)

## S3 method for class 'coa'
explor(obj)

## S3 method for class 'MCA'
explor(obj)

## S3 method for class 'speMCA'
explor(obj)

## S3 method for class 'mca'
explor(obj)

## S3 method for class 'acm'
explor(obj)

## S3 method for class 'PCA'
explor(obj)

## S3 method for class 'princomp'
explor(obj)

## S3 method for class 'prcomp'
explor(obj)

## S3 method for class 'pca'
explor(obj)

Arguments

obj

object containing analysis results

Details

If you want to display supplementary individuals or variables and you're using the dudi.coa function, you can add the coordinates of suprow and/or supcol to as supr and/or supr elements added to your dudi.coa result (See example).

If you want to display supplementary individuals or variables and you're using the dudi.acm function, you can add the coordinates of suprow and/or supcol to as supi and/or supv elements added to your dudi.acm result (See example).

If you want to display supplementary individuals or variables and you're using the dudi.pca function, you can add the coordinates of suprow and/or supcol to as supi and/or supv elements added to your dudi.pca result (See example).

Value

The function launches a shiny app in the system web browser.

Examples

## Not run: 

require(FactoMineR)

## FactoMineR::MCA exploration
data(hobbies)
mca <- MCA(hobbies[1:1000,c(1:8,21:23)], quali.sup = 9:10, 
           quanti.sup = 11, ind.sup = 1:100, graph = FALSE)
explor(mca)

## FactoMineR::PCA exploration
data(decathlon)
d <- decathlon[,1:12]
pca <- PCA(d, quanti.sup = 11:12, graph = FALSE)
explor(pca)

## End(Not run)
## Not run: 

library(ade4)

data(bordeaux)
tab <- bordeaux
row_sup <- tab[5,-4]
col_sup <- tab[-5,4]
coa <- dudi.coa(tab[-5,-4], nf = 5, scannf = FALSE)
coa$supr <- suprow(coa, row_sup)
coa$supc <- supcol(coa, col_sup)
explor(coa)

## End(Not run)
## Not run: 

library(ade4)
data(banque)
d <- banque[-(1:100),-(19:21)]
ind_sup <- banque[1:100, -(19:21)]
var_sup <- banque[-(1:100),19:21]
acm <- dudi.acm(d, scannf = FALSE, nf = 5)
acm$supv <- supcol(acm, dudi.acm(var_sup, scannf = FALSE, nf = 5)$tab)
colw <- acm$cw*ncol(d)
X <- acm.disjonctif(ind_sup)
X <- data.frame(t(t(X)/colw) - 1)
acm$supi <- suprow(acm, X)
explor(acm)

## End(Not run)
## Not run: 

library(ade4)
data(deug)
d <- deug$tab
sup_var <- d[-(1:10), 8:9]
sup_ind <- d[1:10, -(8:9)]
pca <- dudi.pca(d[-(1:10), -(8:9)], scale = TRUE, scannf = FALSE, nf = 5)
supi <- suprow(pca, sup_ind)
pca$supi <- supi
supv <- supcol(pca, dudi.pca(sup_var, scale = TRUE, scannf = FALSE)$tab)
pca$supv <- supv
explor(pca)

## End(Not run)

Graphical representation of indivduals (rows) of a multivariate analysis

Description

This function displays a graphical representation of the individuals (rows) of a multivariate analysis.

This function displays a graphical representation of the individuals (rows) of a multiple correspondence analysis generated by the MCA function of the FactoMineR package.

Usage

ggind(obj, ...)

## S3 method for class 'MCA'
ggind(
  obj,
  xax = 1,
  yax = 2,
  fac = NA,
  label = NULL,
  alpha = 0.5,
  palette = "Set1",
  ...
)

Arguments

obj

a multivariate analysis results object. Currently only MCA is supported

...

arguments passed to other methods

xax

number of the x axis

yax

number of the y axis

fac

an optional factor by which points are colored, and confidence ellipses drawn

label

legend title

alpha

points opacity

palette

palette for points coloring, if fac is not NULL


Graphical representation of the variables (columnss) of a multivariate analysis

Description

This function displays a graphical representation of the variables (columns) of a multivariate analysis.

This function displays a graphical representation of the variables (columns) of a multiple correspondence analysis generated by the MCA function of the FactoMineR package.

Usage

ggvar(obj, ...)

## S3 method for class 'MCA'
ggvar(obj, xax = 1, yax = 2, size = 4, alpha = 0.5, palette = "Set1", ...)

Arguments

obj

a multivariate analysis results object. Currently only MCA is supported

...

arguments passed to other methods

xax

number of the x axis

yax

number of the y axis

size

text size

alpha

points opacity

palette

palette for variables coloring

See Also

MCA


Interactive MCA biplot

Description

This function generates an HTML widget displaying the variables plot of an MCA result.

Usage

MCA_biplot(
  res,
  xax = 1,
  yax = 2,
  col_var,
  ind_sup = TRUE,
  var_sup = TRUE,
  bi_lab_min_contrib = 0,
  symbol_var = NULL,
  ind_point_size = 16,
  var_point_size = 96,
  ind_opacity = 0.5,
  ind_opacity_var = NULL,
  ind_labels = FALSE,
  zoom_callback = NULL,
  in_explor = FALSE,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

col_var

name of the variable for points color

ind_sup

TRUE to display supplementary individuals

var_sup

TRUE to display supplementary variables

bi_lab_min_contrib

Contribution threshold to display points labels

symbol_var

name of the variable for points symbol

ind_point_size

base point size for individuals

var_point_size

base point size for variable levels

ind_opacity

individuals point opacity (constant)

ind_opacity_var

individuals point opacity (variable)

ind_labels

TRUE to display individuals labels

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

...

Other arguments passed to scatterD3


Interactive MCA indivuals plot

Description

This function generates an HTML widget displaying the individuals plot of an MCA result.

Usage

MCA_ind_plot(
  res,
  xax = 1,
  yax = 2,
  ind_sup = TRUE,
  ind_lab_min_contrib = 0,
  lab_var = NULL,
  col_var = NULL,
  symbol_var = NULL,
  opacity_var = NULL,
  size_var = NULL,
  size_range = c(10, 300),
  zoom_callback = NULL,
  in_explor = FALSE,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

ind_sup

TRUE to display supplementary individuals

ind_lab_min_contrib

Contribution threshold to display points labels

lab_var

variable to be used for points names

col_var

variable to be used for points color

symbol_var

name of the variable for points symbol

opacity_var

name of the variable for points opacity

size_var

name of the variable for points size

size_range

points size range with format c(minimum, maximum)

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

...

Other arguments passed to scatterD3


Interactive MCA variables plot

Description

This function generates an HTML widget displaying the variables plot of an MCA result.

Usage

MCA_var_plot(
  res,
  xax = 1,
  yax = 2,
  var_sup = TRUE,
  var_sup_choice = NULL,
  var_lab_min_contrib = 0,
  point_size = 64,
  labels_prepend_var = FALSE,
  col_var = NULL,
  symbol_var = NULL,
  size_var = NULL,
  size_range = c(10, 300),
  zoom_callback = NULL,
  in_explor = FALSE,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

var_sup

TRUE to display supplementary variables

var_sup_choice

list of supplementary variables to display

var_lab_min_contrib

Contribution threshold to display points labels

point_size

base point size

labels_prepend_var

if TRUE, prepend variable names to labels

col_var

name of the variable for points color

symbol_var

name of the variable for points symbol

size_var

name of the variable for points size

size_range

points size range with format c(minimum, maximum)

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

...

Other arguments passed to scatterD3


Interactive PCA indivuals plot

Description

This function generates an HTML widget displaying the individuals plot of a PCA result.

Usage

PCA_ind_plot(
  res,
  xax = 1,
  yax = 2,
  ind_sup = TRUE,
  ind_lab_min_contrib = 0,
  col_var = NULL,
  symbol_var = NULL,
  opacity_var = NULL,
  size_var = NULL,
  size_range = c(10, 300),
  lab_var = NULL,
  zoom_callback = NULL,
  in_explor = FALSE,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

ind_sup

TRUE to display supplementary individuals

ind_lab_min_contrib

Contribution threshold to display points labels

col_var

variable to be used for points color

symbol_var

name of the variable for points symbol

opacity_var

name of the variable for points opacity

size_var

name of the variable for points size

size_range

points size range with format c(minimum, maximum)

lab_var

variable to be used for points names

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

...

Other arguments passed to scatterD3


Interactive PCA variables plot

Description

This function generates an HTML widget displaying the variables plot of a PCA result.

Usage

PCA_var_plot(
  res,
  xax = 1,
  yax = 2,
  var_sup = TRUE,
  var_sup_choice = NULL,
  var_lab_min_contrib = 0,
  scale_unit = FALSE,
  col_var = NULL,
  size_var = NULL,
  zoom_callback = NULL,
  in_explor = FALSE,
  xlim = NULL,
  ylim = NULL,
  ...
)

Arguments

res

Result of prepare_results() call

xax

Horizontal axis number

yax

Vertical axis number

var_sup

TRUE to display supplementary variables

var_sup_choice

list of supplementary variables to display

var_lab_min_contrib

Contribution threshold to display points labels

scale_unit

wether the PCA is scaled

col_var

name of the variable for points color

size_var

name of the variable for points size

zoom_callback

scatterD3 zoom callback JavaScript body

in_explor

wether the plot is to be displayed in the explor interface

xlim

custom x axis limits

ylim

custom y axis limits

...

Other arguments passed to scatterD3


Analysis results preparation

Description

This function prepares results to be used by explor. Not to be used directly.

Usage

prepare_results(obj)

## S3 method for class 'CA'
prepare_results(obj)

## S3 method for class 'mca'
prepare_results(obj)

## S3 method for class 'MCA'
prepare_results(obj)

## S3 method for class 'PCA'
prepare_results(obj)

## S3 method for class 'coa'
prepare_results(obj)

## S3 method for class 'acm'
prepare_results(obj)

## S3 method for class 'pca'
prepare_results(obj)

## S3 method for class 'prcomp'
prepare_results(obj)

## S3 method for class 'princomp'
prepare_results(obj)

## S3 method for class 'speMCA'
prepare_results(obj)

## S3 method for class 'textmodel_ca'
prepare_results(obj)

Arguments

obj

object containing analysis results

See Also

CA

mca

MCA

PCA

CA

dudi.acm

dudi.pca

prcomp

princomp

speMCA

textmodel_ca


Compute supplementary variables data for a GDAtools::speMCA result

Description

Compute supplementary variables data for a GDAtools::speMCA result

Usage

speMCA_varsup(mca, df)

Arguments

mca

result object from speMCA.

df

data frame with the supplementary variables data. Must have the same number of rows than the data used with speMCA.

Value

A list of results suitable to be added as a 'supv' element to the 'mca' object.

See Also

speMCA, varsup