imputeTS (version 2.7)

plotNA.distribution: Visualize Distribution of Missing Values

Description

Visualize the distribution of missing values within a time series.

Usage

plotNA.distribution(x, colPoints = "steelblue",
  colBackgroundMV = "indianred2", main = "Distribution of NAs",
  xlab = "Time", ylab = "Value", pch = 20, cexPoints = 0.8,
  col = "black", ...)

Arguments

x

Numeric Vector (vector) or Time Series (ts) object containing NAs

colPoints

Color of the points for each observation

colBackgroundMV

Color for the background for the NA sequences

main

Main label for the plot

xlab

Label for x axis of the plot

ylab

Label for y axis of plot

pch

Plotting 'character', i.e., symbol to use.

cexPoints

character (or symbol) expansion: a numerical vector.

col

Color for the lines.

...

Additional graphical parameters that can be passed through to plot

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.

See Also

plotNA.distributionBar, plotNA.gapsize, plotNA.imputations

Examples

Run this code
# NOT RUN {
#Example 1: Visualize the missing values in x
x <- ts(c(1:11, 4:9,NA,NA,NA,11:15,7:15,15:6,NA,NA,2:5,3:7))
plotNA.distribution(x)

#Example 2: Visualize the missing values in tsAirgap time series
plotNA.distribution(tsAirgap)

#Example 3: Same as example 1, just written with pipe operator
x <- ts(c(1:11, 4:9,NA,NA,NA,11:15,7:15,15:6,NA,NA,2:5,3:7))
x %>% plotNA.distribution

# }

Run the code above in your browser using DataLab