View source: R/10-extract_data.R
extract_shift_time | R Documentation |
Retrieves the shift time(s) from a lagged correlation object, with an option to process and return them as numeric values.
extract_shift_time(object, numeric = TRUE)
object |
An object that includes a |
numeric |
A logical value; if |
The function first retrieves the shift_time
component of the input object. If the numeric
parameter is set to TRUE
, the function proceeds to convert the shift time(s) to numeric
format. It removes parentheses, splits the string at commas, takes the first element, converts
it to numeric and calculates the mean if there are multiple values. This is all done using
a chain of lapply
and stringr
functions. If numeric
is FALSE, the raw shift time data is
returned as is.
If numeric
is TRUE, returns a numeric vector of the mean shift times extracted from
the object's shift_time
attribute. If numeric
is FALSE, returns the raw shift time
values as they are stored in the object.
The object
is expected to have an accessible shift_time
attribute. The function relies on
the stringr
package for string manipulation.
data("object", package = "laggedcor")
extract_shift_time(object = object, numeric = TRUE)
extract_shift_time(object = object, numeric = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.