plotNA.distributionBar: Visualize Distribution of Missing Values (Barplot)
Description
Visualization of missing values in barplot form. Especially useful for
time series with a lot of observations.
Usage
plotNA.distributionBar(x, breaks = 10, breaksize = NULL, percentage = T,
legend = T, axis = T, space = 0, col = c("indianred2", "green2"),
main = "Distribution of NAs", xlab = "Time", ylab = NULL, ...)
Arguments
x
Numeric Vector (vector) or Time Series (ts) object containing NAs
breaks
Defines the number of bins to be created. If breaksize isn't NULL it is overpowered
by this parameter
breaksize
Defines how many observations should be in one bin. The required number of
overall bins is afterwards calculated automatically.
percentage
Whether the NA / non-NA ration should be given as percent or absolute numbers
legend
If TRUE a legend is shown at the bottom of the plot. A custom legend can be obtained by
setting this parameter to FALSE and using legend function
axis
If TRUE a axis with labels is added. A custom axis can be obtained by
setting this parameter to FALSE and using axis function
space
The amount of space (as a fraction of the average bar width) left before each bar.
col
A vector of colors for the bars or bar components.
main
Main title for the plot
xlab
Label for x axis of the plot
ylab
Label for y axis of plot
...
Additional graphical parameters that can be passed through to barplot
Details
This function visualizes the distribution of missing values within a time series. Therefore
the time series is plotted and whenever a value is NA the background is colored differently.
This gives a nice overview, where in the time series most of the missing values occur.
#Prerequisite: Load a time series with missing valuesx <- tsHeating
#Example 1: Visualize the missing values in this time seriesplotNA.distributionBar(x, breaks = 20)