Learn R Programming

imputeTS (version 1.5)

statsNA: Print Statistics about Missing Values

Description

Print summary stats about the distribution of missing values in a univariate time series.

Usage

statsNA(x, bins = 4, printOnly = T)

Arguments

x
Numeric Vector (vector) or Time Series (ts) object containing NAs
bins
Split number for bin stats. Number of bins the time series gets divided into. For each bin information about amount/percentage of missing values is printed. Default value is 4 - what means stats about the 1st,2nd,3rd,4th quarter of the time series ar
printOnly
Choose if the function Prints or Returns. For printOnly = TRUE the function has no return value and just prints out missing value stats. If printOnly is changed to FALSE, nothing is printed and the function returns a list. Print gives a little bit more

Value

  • A list containing the stats. Beware: Function gives only a return value if printOnly = FALSE.

Details

Prints the following information about the missing values in the time series:
  • "Length of time series" - Number of observations in the time series (including NAs)
"Number of Missing Values" - Number of missing values in the time series "Percentage of Missing Values" - Percentage of missing values in the time series "Stats for Bins" - Number/percentage of missing values for the split into bins "Longest NA gap" - Longest series of consecutive missing values (NAs in a row) in the time series "Most frequent gap size" - Most frequent occuring series of missing values in the time series "Gap size accounting for most NAs" - The series of consecutive missing values that accounts for most missing values overall in the time series "Overview NA series" - Overview about how often each series of consecutive missing values occurs. Series occuring 0 times are skipped

See Also

plotNA.distribution,plotNA.distributionBar, plotNA.gapsize

Examples

Run this code
#Prerequisite: Load a time series with missing values
x <- tsNH4

#Example 1: Print stats about the missing data
statsNA(x)

Run the code above in your browser using DataLab