tween_appear: Tween a data.frame of appearances

View source: R/tween_appear.R

tween_appearR Documentation

Tween a data.frame of appearances

Description

This function is intended for use when you have a data.frame of events at different time points. This could be the appearance of an observation for example. This function replicates your data nframes times and calculates the duration of each frame. At each frame each row is assigned an age based on the progression of frames and the entry point of in time for that row. A negative age means that the row has not appeared yet.

Usage

tween_appear(data, time, timerange, nframes)

Arguments

data

A data.frame to tween

time

The name of the column that holds the time dimension. This does not need to hold time data in the strictest sence - any numerical type will do

timerange

The range of time to create the tween for. If missing it will defaults to the range of the time column

nframes

The number of frames to create for the tween. If missing it will create a frame for each full unit in timerange (e.g. timerange = c(1, 10) will give nframes = 10)

Value

A data.frame as data but repeated nframes times and with the additional columns .age and .frame

See Also

Other data.frame tween: tween_along(), tween_components(), tween_elements(), tween_events(), tween_states()

Examples

data <- data.frame(
  x = rnorm(100),
  y = rnorm(100),
  time = sample(50, 100, replace = TRUE)
)

data <- tween_appear(data, 'time', nframes = 200)


tweenr documentation built on May 29, 2024, 6:32 a.m.