reso_dm: Detect Temporal Resolution and Irregularities in Time Series

View source: R/reso_dm.R

reso_dmR Documentation

Detect Temporal Resolution and Irregularities in Time Series

Description

Determines the average temporal resolution (in minutes) of a time series vector (e.g., dendrometer timestamps) and detects inconsistencies in time intervals. If the time column is character-formatted, it is automatically converted to POSIXct. Any inconsistent intervals are flagged and printed.

Usage

reso_dm(input_time)

Arguments

input_time

A vector of class POSIXct, Date, or character representing time stamps.

Details

This function is helpful for checking if a time series (especially dendrometer data) is regularly sampled. It handles both regular and irregular timestamps and gives feedback if the resolution changes.

Value

A single integer: the estimated (rounded) average resolution in minutes. If multiple intervals are detected, a warning and index positions are printed.

Examples

## Not run: 
# Regular 30-minute time sequence
time_seq <- seq.POSIXt(from = as.POSIXct("2023-06-01 00:00:00"),
                       by = "30 min", length.out = 100)
reso_dm(time_seq)  # Should return 30

# With character time input
time_char <- format(time_seq, format = "%Y-%m-%d %H:%M:%S")
reso_dm(time_char)  # Auto converts to POSIXct

# Introduce an irregular step
time_seq[51] <- time_seq[50] + 60  # One-time 1-hour jump
reso_dm(time_seq)  # Should print warning and irregular step index

## End(Not run)


dendRoAnalyst documentation built on May 20, 2026, 5:07 p.m.