Skip to contents

Converts Inf, -Inf, and NaN to NA (via tsl_Inf_to_NA() and tsl_NaN_to_NA()), and counts the total number of NA cases in each time series.

Usage

tsl_count_NA(tsl = NULL, quiet = FALSE)

Arguments

tsl

(required, list) Time series list. Default: NULL

quiet

(optional, logical) If TRUE, all messages are suppressed. Default: FALSE

Value

list

Examples

#tsl with no NA cases
tsl <- tsl_simulate()

tsl_count_NA(tsl = tsl)
#> $A
#> [1] 0
#> 
#> $B
#> [1] 0
#> 

#tsl with NA cases
tsl <- tsl_simulate(
  na_fraction = 0.3
)

tsl_count_NA(tsl = tsl)
#> distantia::tsl_count_NA(): NA cases in 'tsl': 
#>   name NA_cases
#> 1    A      150
#> 2    B      150
#> Please impute, replace, or remove them with tsl_handle_NA().FALSE
#> $A
#> [1] 150
#> 
#> $B
#> [1] 150
#> 

#tsl with variety of empty cases
tsl <- tsl_simulate()
tsl[[1]][1, 1] <- Inf
tsl[[1]][2, 1] <- -Inf
tsl[[1]][3, 1] <- NaN
tsl[[1]][4, 1] <- NaN

tsl_count_NA(tsl = tsl)
#> distantia::tsl_count_NA(): NA cases in 'tsl': 
#>   name NA_cases
#> 1    A        4
#> 2    B        0
#> Please impute, replace, or remove them with tsl_handle_NA().FALSE
#> $A
#> [1] 4
#> 
#> $B
#> [1] 0
#>