Learn R Programming

HelpersMG (version 3.6)

plot.IconoCorel: Clean the dataframe before to be used with IC_threshold_matrix

Description

This function plots the data as a network. It returns an invisible object that can be used with visIgraph from package visNetwork. https://fr.wikipedia.org/wiki/Iconographie_des_corr<U+00E9>lations

Usage

# S3 method for IconoCorel
plot(x, ..., show.legend.direction = "bottomright",
  show.legend.strength = "topleft", title = "Correlation iconography",
  vertex.label.color = "black", vertex.label = NULL,
  vertex.color = "white", plot = TRUE)

Arguments

x

The correlation matrix to show

...

other options of plot.igraph()

show.legend.direction

the position of the legend of direction; FALSE to not show it

show.legend.strength

the position of the legend with intensity of correlation; FALSE to not show it

title

the title of the plot

vertex.label.color

a vector with the colors of labels

vertex.label

a vector with the labels

vertex.color

a vector of colors

plot

if TRUE, the plot is shown

Value

A igraph object

Details

plot.IconoCorel checks and corrects the dataframe to be used with IC_threshold_matrix

References

Lesty, M., 1999. Une nouvelle approche dans le choix des r<U+00E9>gresseurs de la r<U+00E9>gression multiple en pr<U+00E9>sence d<U+2019>interactions et de colin<U+00E9>arit<U+00E9>s. Revue de Modulad 22, 41-77.

See Also

Other Iconography of correlations: IC_clean_data, IC_correlation_simplify, IC_threshold_matrix

Examples

Run this code
# NOT RUN {
library("HelpersMG")
es <- matrix(c("e1", "52", "12", "12", "5",
"e2", "59", "12.5", "9", "5",
"e3", "55", "13", "15", "9",
"e4", "58", "14.5", "5", "5",
"e5", "66", "15.5", "11", "13.5",
"e6", "62", "16", "15", "18",
"e7", "63", "17", "12", "18",
"e8", "69", "18", "9", "18"), ncol=5, byrow = TRUE)
colnames(es) <- c("<U+00C9>l<U+00E8>ve", "Poids", "<U+00C2>ge", "Assiduit<U+00E9>", "Note")
es <- as.data.frame(es, stringsasFactor=FALSE)
es[, 2] <- as.numeric(as.character(es[, 2]))
es[, 3] <- as.numeric(as.character(es[, 3]))
es[, 4] <- as.numeric(as.character(es[, 4]))
es[, 5] <- as.numeric(as.character(es[, 5]))

es

df <- IC_clean_data(es, debug = TRUE)
cor_matrix <- IC_threshold_matrix(data=df, threshold = NULL, progress=FALSE)
cor_threshold <- IC_threshold_matrix(data=df, threshold = 0.3)
par(mar=c(1,1,1,1))
set.seed(4)
library("igraph")
library("visNetwork")
kk <- plot(cor_threshold, vertex.color="red")
# it can be shown also with the visNetwork package
visIgraph(kk)
cor_threshold_Note <- IC_correlation_simplify(matrix=cor_threshold, variable="Note")
plot(cor_threshold_Note)
# }

Run the code above in your browser using DataLab