plotIncMatrix: Plot the incidence matrix.

View source: R/plot-incidence-matrix.R

plotIncMatrixR Documentation

Plot the incidence matrix.

Description

This function converts a nominal data edge list to an incidence matrix and provides some information about that.

Usage

plotIncMatrix(
  x,
  index_nominal = c(1, 2),
  index_numeric = NULL,
  palette = "Blues",
  verbose = FALSE,
  plot_weight = FALSE,
  print_skim = FALSE
)

Arguments

x

A data frame containing at least 2 nominal columns and an optional numeric column.

index_nominal

A vector made up of two numbers that serve as nominal columns. The first value indicates the incidence matrix's row name, while the second value represents the incidence matrix's column name. It is c (1,2) by default, which implies that the first column in the x data frame is the incidence matrix's row, and the second column in the x data frame is the incidence matrix's column.

index_numeric

An integer, the index of a numeric variable. This is the value used to select the column that contains weight score values for pairwise relationships, and it is used to fill the elements of the incidence matrix. These values are also utilized for investigating missing data and predicting edges via imputation.

palette

A string or number. Color palette used for the heat map. By default, it sets to "Blues". (Find more option in the manual of scale_fill_distiller()).

verbose

A logical value, If it is set to TRUE, the plot is saved as the .png file in the working directory. By default, it is set to FALSE.

plot_weight

A logical value, If it is set to TRUE, the plot is displayed with the corresponding colors based on weight scores, otherwise the binary matrix image is displayed. By default, it is set to FALSE.

print_skim

A logical value, If TRUE, then the function prints skim information in console.

Details

This function mainly converts data in the form of edge list into matrix data. It also returns the incidence matrix object, the dimensions and proportion of missing values, as well as the matrix's image for visualization.

Value

An incidence matrix object and image with the dimension and missing value proportion.

See Also

nominalAsBinet

Examples

# load part of the beatAML data
beatAML_data <- NIMAA::beatAML[1:1000,]

# visualize the input dataset
beatAML_incidence_matrix <- plotIncMatrix(beatAML_data,
index_numeric= 3)

NIMAA documentation built on April 11, 2022, 5:05 p.m.