flat {INQC}R Documentation

Flat sequences

Description

This function detects consecutive equal values (e.g., 15.1, 15.1, 15.1, 15.1...) in a data time series. Also can be used to detect consecutive equal decimal part of the values (e.g., 15.1, 12.1, 13.1, 10.1 ...)

Usage

flat(y, maxseq, exclude = NULL)

Arguments

y

data vector

maxseq

the maximum number of contiguous repetitions of a value (e.g., if 3, sequences of 4 will be flagged)

exclude

values to be excluded. This is useful for variables where a single value is expected to repeat many times, e.g. 0.0 in precipitation.

Value

list of positions which do not pass this QC test. If all positions pass the test, returns NULL

Examples

y<-rnorm(100)
y[10:20]<-10
flat(y,5)

#Extract the ECA&D data file from the example data folder
path2inptfl<-system.file("extdata", "TX_SOUID132734.txt", package = "INQC")
#Read the data file
y<-readecad(input=path2inptfl,missing= -9999)[,4]
#Find all consecutive (with a length > 5 elements) equal values in the time series
flat(y,5)

#Introduce the duplicated dates
y[6:12]<-10
#Find all consecutive (with a length > 5 elements) equal values in the time series
flat(y,5)

[Package INQC version 2.0.5 Index]