plotNA {analyzer} | R Documentation |
Missing value visualization using ggplot2
Description
plotNA
returns a grob visualizing the missing values in data
Usage
plotNA(tb, order = T, limit = T, add_percent = T, row.level = F)
Arguments
tb |
a data.frame |
order |
(logical) Whether to order the variables based on missing values in plot |
limit |
(logical) Whether to limit the plot to maximum missing value. FALSE means the limit of axis will be [0, nrow(tb)] |
add_percent |
(logical) Whether to add percent as data labels on bar plot |
row.level |
(logical) Whether to create plot at rows and variables level |
Details
This is a function which helps in visualizing the missing values in data using plots. By default a bar plot is generated which shows the count of missing values in each variable.
If order
is set as TRUE
then the bars are arranged in order of
missing values. If limit
is set as TRUE
then limit of axis is
set to [0, nrow(tb)]. If add_percent
is set as TRUE
then
percent is added as text to the bars. If row.level
is set to
TRUE
then an additional plot is generated which shows which rows have
missing values and in which variable (reshape2
(https://CRAN.R-project.org/package=reshape2) library
is required for this).
Value
This function returns a grob of class 'analyzePlot' which has a bar
plot showing the count of missing value for each variable. order,
limit, add_percent
can be used to modify the bar plot. An additional plot
will be created and added to the grob if row.level
is set as
TRUE
Examples
p <- plotNA(airquality)
# function to show the 'analyzerPlot' class plot
plot(p)
p1 <- plotNA(airquality, order = FALSE)
plot(p1)