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)
x | A |
---|
A tibble with logged event-information. Each row represents an event. The column layout is specific to the function, which produced the event-log.
raw_signals
(dataset in examples)
#> # 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()#> # 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]>#> [[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> #>