maxLagMissVal: Get maximum lag of missing values

View source: R/maxLagMissVal.R

maxLagMissValR Documentation

Get maximum lag of missing values

Description

This function computes the maximum amount of consecutive missing values in a vector. This quantity is also known as maximum lag, run, or record, and can be used as a rough estimate of the quality of a dataset.

Usage

maxLagMissVal(x, type = c("NA", "numeric"), value)

Arguments

x

numeric vector.

type

character specifying the type of missing value to consider. Default is type="NA"; when type="numeric", value must be provided.

value

numeric giving a figure to be used to fill missing values; often as part of a pre-processing, missing values in a dataset (vector, time series, etc.) are fill in with pre-established values.

Value

A list containing:

maxLag

numeric giving the maximum lag of missing values in x

x

numeric vector with the original data

value

a numeric when type=numeric, NA otherwise

See Also

rle

Examples

v <- c(NA, 0.12, 0.58, 0.75, NA, NA, NA, 0.46, 0.97, 0.39,
       NA, 0.13, 0.46, 0.95, 0.30, 0.98, 0.23, 0.98,
       0.68, NA, NA, NA, NA, NA, 0.11, 0.10, 0.79, 0.46, 0.27,
       0.44, 0.93, 0.20, 0.44, 0.66, 0.11, 0.88)
maxLagMissVal(x=v, type="NA")

w <- c(23,3,14,3,8,3,3,3,3,3,3,3,10,14,15,3,10,3,3,6)
maxLagMissVal(x = w, type = "numeric", value = 3)
       

geoTS documentation built on Nov. 18, 2022, 1:08 a.m.