For some occasions (like in long-running computations) it may not be desired to shut down the whole computation if a single error occurrs. It may be better to log the occurred error and carry on with the computation. In such a case, NA will always be the result of a failed computation. The logged information can be retrieved via mbte_event_log() (see examples).

mbte_event_log(x)

Arguments

x

A tbl_mbte with event-log information stored in attributes.

Value

A tibble with logged event-information. Each row represents an event. The column layout is specific to the function, which produced the event-log.

See also

raw_signals (dataset in examples)

Examples

library(dplyr, warn.conflicts = FALSE) data(raw_signals) raw_signals
#> # A tibble: 4,200 x 3 #> t mv value #> <int> <chr> <dbl> #> 1 1 mv1 0 #> 2 2 mv1 0 #> 3 3 mv1 0 #> 4 4 mv1 0 #> 5 5 mv1 0 #> 6 6 mv1 0 #> 7 7 mv1 0 #> 8 8 mv1 0 #> 9 9 mv1 0 #> 10 10 mv1 0 #> # … with 4,190 more rows
# prepare for signal extraction (perform conversion to `tbl_mbte` and nest # signals) raw_signals <- raw_signals %>% group_by(mv) %>% new_tbl_mbte(time = "t", value = "value") %>% mbte_nest_signals() # provoke an error by passing an indexing-function, that will always raise # an error faulty_extract <- mbte_extract_subsignals(raw_signals, f = function(x) { stop("test") })
#> Warning: Unusual events occurred during execution of `mbte_extract_subsignals()` ==> can be retrieved via mbte_event_log()
# retrieve event-log event_log <- mbte_event_log(faulty_extract) head(event_log)
#> # A tibble: 6 x 3 #> error row_nr signal #> <list> <int> <list> #> 1 <S3: simpleError> 1 <tibble [100 × 2]> #> 2 <S3: simpleError> 2 <tibble [100 × 2]> #> 3 <S3: simpleError> 3 <tibble [100 × 2]> #> 4 <S3: simpleError> 4 <tibble [100 × 2]> #> 5 <S3: simpleError> 5 <tibble [100 × 2]> #> 6 <S3: simpleError> 6 <tibble [100 × 2]>
# show occurred errors head(event_log$error)
#> [[1]] #> <simpleError in indexer(x[[value_str]], ...): test> #> #> [[2]] #> <simpleError in indexer(x[[value_str]], ...): test> #> #> [[3]] #> <simpleError in indexer(x[[value_str]], ...): test> #> #> [[4]] #> <simpleError in indexer(x[[value_str]], ...): test> #> #> [[5]] #> <simpleError in indexer(x[[value_str]], ...): test> #> #> [[6]] #> <simpleError in indexer(x[[value_str]], ...): test> #>