This function extracts loose data variables from tag sensor data lists. It can also be used to check two sensor data lists for compatibility (i.e., same duration and sampling rate).

sens2var(Sx, Sy = NULL, regular = NULL)

Arguments

Sx

A tag sensor data structure (for example, an entry in an animaltag object returned by load_nc).

Sy

(optional) A second tag sensor data structure. Include if you want to check two tag sensor data streams for compatibility in terms of duration and sampling rate.

regular

(optional) Logical. Default is FALSE. Should Sx be checked to see whether it was regularly sampled?

Value

A list with entries:

  • X: Data vector or matrix from sensor Sx, with the same units of measure and sampling rate as in Sx. NULL if regular is TRUE and the data Sx are not regularly sampled, or if Sx is not a tag sensor data list.

  • Y: Data vector or matrix from sensor Sy, with the same units of measure and sampling rate as in Sx. NULL unless Sy was input, and NULL if Sy is not a tag sensor data list.

  • fs: sampling rate of the sensor data in Hz (samples per second), if Sx was regularly sampled.

  • t: Times (in seconds) of irregularly sampled data. The time reference (i.e., the 0 time) is with respect to the start time of the data in the sensor structure. NULL unless Sx had irregular sampling and Sx is a tag sensor data list.

  • sampling: NULL unless input regular is TRUE. 'regular' if sampling of Sx was regular, 'irregular' if it was irregular.

Note

This function is provided for the compatibility checking functionality and for parallel operation with the matlab/octave tag toolkit. However, in R loose variables in the workspace are less commonly used in R, and an R function does not return multiple objects as matlab functions can. Thus, the result of "unpacking" a sensor list is the same data...stored in different and less well documented list (pretty useless).

Examples

# no example given because hard to figure out when you'll use it!