getNewGapsInd {KarsTS} | R Documentation |
A function to create random gaps
Description
This function creates nGaps gaps of length lGaps in the time series timSer. It is used internally. The gaps do not overlay amongst them; they do not overlay pre-existing gaps either.
Usage
getNewGapsInd(timSer, lGaps, nGaps)
Arguments
timSer |
The time series where the gaps will be created. |
lGaps |
The length of the gaps |
nGaps |
The number of gaps. |
Value
A vector containing the indices of the gaps
Author(s)
Marina Saez Andreu
Examples
# Create time series
TS <- genTSExample(InKTSEnv = FALSE)[1:50,]
# Create 3 gaps of 7 NAs each
gInd <- getNewGapsInd(TS, 7, 3)
# Create time series duplicate and apply the gaps
TS1 <- TS
TS1$value[gInd] <- NA
#Compare
cbind(TS, TS1$value)
[Package KarsTS version 2.4.1 Index]