This function modifies time values in a dataset to match a new framerate and updates the corresponding metadata. It handles both integer and non-integer time values, ensuring time series start from zero when appropriate.
Details
The function calculates a scaling factor based on the ratio of old to new framerates. For integer time values, it ensures they start from zero. All time values are then scaled proportionally to maintain relative temporal relationships.
Examples
data <- data.frame(time = 0:10, value = rnorm(11))
result <- set_framerate(data, framerate = 60, old_framerate = 30)