impute_plot {promor} | R Documentation |
Visualize the impact of imputation
Description
This function generates density plots to visualize the impact of missing data imputation on the data.
Usage
impute_plot(
original,
imputed,
global = TRUE,
text_size = 10,
palette = "viridis",
n_row,
n_col,
save = FALSE,
file_path = NULL,
file_name = "Impute_plot",
file_type = "pdf",
plot_width = 7,
plot_height = 7,
dpi = 80
)
Arguments
original |
A |
imputed |
An |
global |
Logical. If |
text_size |
Text size for plot labels, axis labels etc. Default is
|
palette |
Viridis color palette option for plots. Default is
|
n_row |
Used if |
n_col |
Used if |
save |
Logical. If |
file_path |
A string containing the directory path to save the file. |
file_name |
File name to save the density plot/s.
Default is |
file_type |
File type to save the density plot/s.
Default is |
plot_width |
Width of the plot. Default is |
plot_height |
Height of the plot. Default is |
dpi |
Plot resolution. Default is |
Details
Given two data frames, one with missing values and the other, an imputed data frame (
imp_df
object) of the same data set,impute_plot
generates global or sample-wise density plots to visualize the impact of imputation on the data set.Note, when sample-wise option is selected (
global = FALSE
),n_col
andn_row
can be used to specify the number of columns and rows to print the plots.If you choose to specify
n_row
andn_col
, make sure thatn_row
*n_col
matches the total number of samples in the data frame.
Value
A ggplot2
plot object.
Author(s)
Chathurani Ranathunge
Examples
## Generate a raw_df object with default settings. No technical replicates.
raw_df <- create_df(
prot_groups = "https://raw.githubusercontent.com/caranathunge/promor_example_data/main/pg1.txt",
exp_design = "https://raw.githubusercontent.com/caranathunge/promor_example_data/main/ed1.txt"
)
## Impute missing values in the data frame using the default minProb
## method.
imp_df <- impute_na(raw_df)
## Visualize the impact of missing data imputation with a global density
## plot.
impute_plot(original = raw_df, imputed = imp_df)
## Make sample-wise density plots
impute_plot(raw_df, imp_df, global = FALSE)
## Print plots in user-specified numbers of rows and columns
impute_plot(raw_df, imp_df, global = FALSE, n_col = 2, n_row = 3)