This function is responsible for creating the `signal`-list-column of a tbl_mbte. This gets done by combining the `time`- and `value`-column of x via nesting (nest is used). This step is necessary, since functions like mbte_fit or mbte_compute_metrics rely on the presence of the `signal`-column. It is required to specify grouping columns (either by passing them via ... or by passing a grouped table as the x-parameter).

mbte_nest_signals(x, ...)

Arguments

x

A tbl_mbte containing `time`- and `value`-columns.

...

Variables (get quoted), which can be used for grouping. If no variables are specified, it is assumed, that x is already a grouped table.

Details

This function is meant to operate on `long`-datasets. Hence, columns for signal-time, signal-values and a variable describing the measured parameter should be present. Therefore, the "measurement-variable"-column is used for grouping if the goal is to find out, which measured parameters have an underlying trend (see examples).

Note

In any case, grouping variables specified in ... are prioritised over the grouping columns of a grouped table (if x is grouped).

See also

raw_signals (dataset used in examples)

Examples

library(dplyr, warn.conflicts = FALSE) data(raw_signals) # create ungrouped tbl_mbte tbl <- new_tbl_mbte(raw_signals, time = "t", value = "value") # NOTE: grouping variable specified manually (grouping based on the # "measurement variable"-column, which is describing the measured parameter) mbte_nest_signals(tbl, "mv")
#> # A tibble: 42 x 2 #> mv signal #> <chr> <list> #> 1 mv1 <tibble [100 × 2]> #> 2 mv2 <tibble [100 × 2]> #> 3 mv3 <tibble [100 × 2]> #> 4 mv4 <tibble [100 × 2]> #> 5 mv5 <tibble [100 × 2]> #> 6 mv6 <tibble [100 × 2]> #> 7 mv7 <tibble [100 × 2]> #> 8 mv8 <tibble [100 × 2]> #> 9 mv9 <tibble [100 × 2]> #> 10 mv10 <tibble [100 × 2]> #> # … with 32 more rows
# alternative: use pregrouped table tbl <- raw_signals %>% group_by(mv) %>% new_tbl_mbte(time = "t", value = "value") # yields the same result mbte_nest_signals(tbl)
#> # A tibble: 42 x 2 #> mv signal #> <chr> <list> #> 1 mv1 <tibble [100 × 2]> #> 2 mv2 <tibble [100 × 2]> #> 3 mv3 <tibble [100 × 2]> #> 4 mv4 <tibble [100 × 2]> #> 5 mv5 <tibble [100 × 2]> #> 6 mv6 <tibble [100 × 2]> #> 7 mv7 <tibble [100 × 2]> #> 8 mv8 <tibble [100 × 2]> #> 9 mv9 <tibble [100 × 2]> #> 10 mv10 <tibble [100 × 2]> #> # … with 32 more rows