mbte_extract_subsignals: Extract subsignals from a 'tbl_mbte'-object

Description Usage Arguments Value event-logging event-log See Also Examples

View source: R/extract_subsignals.R

Description

This function depends on an existing 'signal'-column (see tbl_mbte). The indexing function f is used to split a signal into subsignals. This function is useful, if only certain parts of a signal are relevant (e.g. remove parts, where the measured signal-values are below a specific threshold via a custom indexing-function).

Usage

1

Arguments

x

A tbl_mbte-object.

f

An indexing-function.

...

Additional arguments passed to 'f'

Value

The original table gets returned. The 'signal'-column is modified (since subsignals are extracted according to the indexing function f). Additionally, the column 'signal_nr' is added, which indicates the number of the subsignal within the original signal.

e.g. Assuming that x only contains one row (hence only one element is present in the 'signal'-list column). The indexing function f determines, that the signal contains 3 subsignals. Therefore, the original signal-tibble is split into 3 tibbles. The returned table will have 3 rows. The column 'signal_nr' will be equal to c(1, 2, 3).

event-logging

This function logs unusual events. A warning gets raised at the end of an execution, if events have been logged. The event-log can be retrieved by passing the returned object to mbte_event_log. In this case, a tibble containing the logged events will be returned to the user.

event-log

The tibble containing event-information consists of 3 columns:

error

The unprocessed error, which occurred during execution.

row_nr

The row-number of the input-tibble (x), at which the error occurred.

signal

The signal-subtable processed at the time the error occurred.

NOTE: currently warnings are not logged.

See Also

raw_signals (dataset used in examples)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(dplyr, warn.conflicts = FALSE)
data(raw_signals)

# create nested tbl_mbte (needed for subsignal-extraction)
tbl <- raw_signals %>%
  group_by(mv) %>%
  new_tbl_mbte(time = "t", value = "value") %>%
  mbte_nest_signals()

# a signal-subtable with leading zeros (should be removed)
tbl$signal[[9]]

# perform subsignal extraction
#
# by default, mbte_default_indexer() gets used for signal-extraction
# in this case only nonzero values are interesting
extracted <- mbte_extract_subsignals(tbl)
extracted

mkerschbaumer/mbte documentation built on May 5, 2019, 11:01 p.m.