add_times: Add time columns to time-series

View source: R/add_times.R

add_timesR Documentation

Add time columns to time-series

Description

Add time (in seconds since tagon and perhaps as datetimes in UTC and/or local timezone) to a tibble or data-frame with regularly sampled data

Usage

add_times(x, sampling_rate, start_offset = 0, add_utc_time = FALSE, tagon_time)

Arguments

x

input data: sensor data structure, vector, matrix, tibble, or data frame. If x is not a tag sensor data structure, then sampling_rate is required input.

sampling_rate

sampling rate of x in Hz (required if x is not a sensor data structure, and ignored if it is)

start_offset

time (in seconds) between start of tag recording and the first recorded sample. Ignored (and pulled from metadata) if x is a sensor data structure. default: 0

add_utc_time

Logical: should UTC time column be added? Default is FALSE.

tagon_time

string giving the tag recording start time. Can be found in tag_dataset$info$dephist_device_datetime_start. Format: day month year hours minutes seconds. Required if add_dttm is TRUE.

Value

A data.frame with the data (one row per sample) and column sec_since_tagon with times in seconds since start of tag recording. Optionally, also includes column utc_time.

Examples

# Examples will go here

stacyderuiter/FBtagtools documentation built on June 1, 2025, 6:26 p.m.