Learn R Programming

imputeTS (version 1.7)

plotNA.gapsize: Visualize Distribution of NA gap sizes

Description

Visualize Distribution of NA gap sizes (NAs in a row) in a time series

Usage

plotNA.gapsize(x, limit = 10, byTotalNA = FALSE, legend = TRUE, col = c("indianred", "steelblue"), xlab = "Ranking of the different gap sizes", ylab = "Number", main = "Occurance of gap sizes (NAs in a row)", cex.names = 0.7, horiz = FALSE, axes = TRUE, beside = TRUE, las = 1, ...)

Arguments

x
Numeric Vector (vector) or Time Series (ts) object containing NAs
limit
Specifies how many of the top gap sizes are shown in the plot.
byTotalNA
For byTotalNA = TRUE the top gap sizes according to their overall weight are shown. (occurrence * gap size) For byTotalNA = FALSE the top gap sizes are shown by their number of occurrence. (occurrence)
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
col
A vector of colors for the bars or bar components.
xlab
Label for x axis of the plot
ylab
Label for y axis of plot
main
Main title for the plot
cex.names
Expansion factor for axis names (bar labels).
horiz
A logical value. If FALSE, the bars are drawn vertically with the first bar to the left. If TRUE, the bars are drawn horizontally with the first at the bottom.
axes
Logical. If TRUE, a vertical (or horizontal, if horiz is true) axis is drawn.
beside
A logical value. If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars.
las
Numeric in 0,1,2,3; the style of axis labels. 0:always parallel to the axis, 1:always horizontal, 2:always perpendicular to the axis, 3:always vertical.
...
Additional graphical parameters that can be passed through to barplot

Details

This plotting function can be used to visualize the length of the NA gaps (NAs in a row) in a time series. It shows a ranking of which gap sizes occur most often. This ranking can be ordered by total NAs for this gap size (occurrence * gap length) or by occurrence of the gap size. The outcome will be somethink like in the time series 2NAs in a row occurred 27times, 4NAs in a row occurred 11 times, 7NAs in a row occurred 5 times, 1NA in a row occurred 3 times, ... .

See Also

plotNA.distribution,plotNA.distributionBar, plotNA.imputations

Examples

Run this code
#Example 1: Visualize the top gap sizes in tsNH4
plotNA.gapsize(tsNH4)

#Example 2: Visualize the top gap sizes in tsAirgap
plotNA.gapsize(tsAirgap)

Run the code above in your browser using DataLab