minutebins: Time to Minute-Bin Factors

Description Usage Arguments Details Value Examples

Description

This function takes time in an ITime object and creates a factor representing time-length bins. For example, 09:36:56 will be given a factor 09:30:00 if 10-minute length bins are desired.

Usage

1
minutebins(x, minutes)

Arguments

x

a one column of a data.table containing a time in the ITime, "09:30:00" represents hours, minutes, and seconds.

minutes

length of the desired time bins. Must divide hours in to equal bins

Details

This function is intended to be vectorized over a data.table object. See examples below.

Value

An ITime object.

Examples

1
2
3
4
5
datasample <- as.data.table(bboread('data-raw/XCBT_C_FUT_110110.TXT'))
datasample[, c("TradeDate", "TradeTime") := .(datemanip(datasample[, 1, with=FALSE]), timemanip(datasample[, 2, with=FALSE]))]
datasample
datasample[, bins := minutebins(datasample[, 2, with=FALSE], 10)]
datasample

ProfMalloryResearch/BBOToolkit documentation built on May 8, 2019, 3:23 a.m.