timeBins {itsadug}R Documentation

Label timestamps as timebins of a given binsize.

Description

Function for calculating timebins.

Usage

timeBins(x, binsize, pos = 0.5)

Arguments

x

Numerical vector with timestamp information.

binsize

Size of the timebin, measured in the same units (often ms) as x.

pos

Numerical value that determines the label of the binsize as proportion of the binsize. A value of 0 will provide the minimum timestamp within the bin as label, a value of 1 will provide the maximum value within the bin as label. Defaults to 0.5, the center of the bin.

Value

Anumerical vector of the same size as x with timebin information.

Author(s)

Jacolien van Rij

See Also

Other Utility functions: convertNonAlphanumeric(), corfit(), diff_terms(), find_difference(), missing_est(), modeledf(), observations(), print_summary(), refLevels(), res_df(), summary_data()

Examples

data(simdat)
# grouping Time values in bins:
simdat$Timebin <- timeBins(simdat$Time, 200)
head(simdat)

# different labels:
simdat$Timebin2 <- timeBins(simdat$Time, 200, pos=0)
head(simdat)

[Package itsadug version 2.4.1 Index]