mbte_reconstruct: Reconstruct a 'tbl_mbte' from template-object

Description Usage Arguments Details See Also Examples

View source: R/reconstruct.R

Description

This function is used to readd dropped-attributes, if a tbl_mbte-object gets processed by functions, which may drop additional attributes.

Usage

1
2
3
4
mbte_reconstruct(new, old)

## S3 method for class 'tbl_mbte'
mbte_reconstruct(new, old)

Arguments

new

Object, which the attributes should be added to (must be convertible to a tibble).

old

tbl_mbte, from which specific attributes are copied ('time', 'value', 'signal', 'fits'). Additionally, the class 'tbl_mbte' gets added. The S3-generic dispatches on this argument.

Details

The implementation of sloop::reconstruct() gets used; This is a temporary workaround and will be removed, once the sloop-package is on CRAN.

See Also

raw_signals (dataset used in examples)

Other tbl_mbte functions: is_tbl_mbte, new_tbl_mbte, tbl_mbte

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(raw_signals)

# create template object for attribute reconstruction
template <- new_tbl_mbte(raw_signals, time = "t", value = "value")

# create target object, which lacks of the "time"-attribute
target <- new_tbl_mbte(raw_signals, time = "t", value = "value")
attr(target, "time") <- NULL


is_tbl_mbte(target) # FALSE

# reconstruct valid tbl_mbte from template
target <- mbte_reconstruct(target, template)


is_tbl_mbte(target) # TRUE

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