R/gapForSelMethod.R

Defines functions gapForSelMethod

Documented in gapForSelMethod

gapForSelMethod <-
function(selTsName, selTs, envir = KTSEnv) {
  if (exists("selGapP", envir = KTSEnv) == FALSE) {
    selGapName <- "All"
    selGap <- list(gaps = which(is.na(selTs$value)), 
                   tsIni = as.character(selTs$time[1]), 
                   tsEnd = selTs$time[nrow(selTs)], 
                   samPerMin = diff(as.numeric(selTs$time[1:2]))/60, 
                   tsLength = nrow(selTs), tsName = selTsName)
  } else {
    selGapName <- verifyCharEntry(tcltk::tclvalue(KTSEnv$selGapP), 
                                  noValid = NA)
    if (is.na(selGapName)) {
      selGapName <- "All"
      selGap <- list(gaps = which(is.na(selTs$value)), 
                     tsIni = as.character(selTs$time[1]), 
                     tsEnd = selTs$time[nrow(selTs)], 
                     samPerMin = diff(as.numeric(selTs$time[1:2]))/60, 
                     tsLength = nrow(selTs), tsName = selTsName)
    } else {
      selGap <- get(selGapName, envir = envir)
    }
  }
  gapToUse <- list(selGapName = selGapName, selGap = selGap)
}

Try the KarsTS package in your browser

Any scripts or data that you put into this service are public.

KarsTS documentation built on Jan. 16, 2021, 5:07 p.m.