SeqList: Separate Dataframe by Time Window

Description Usage Arguments Details Value Examples

View source: R/SeqList.R

Description

Function to separate the dataframe into a list by the time window specified.

Usage

1
SeqList(df, timetype)

Arguments

df

Dataframe: first column time stamps in POSIXct format, second column sequence in factor format.

timetype

Time window for separating the dataset, i.e. day = '%Y-%m-%d', week = '%Y-%W' and month '%Y-%m'.

Details

Simple function to separate a dataframe into a list of dataframes by the time window desired. The dataframe must be in a specific format to be separated; first column - time stamps that provide enough information to adapt to the chosen time window, second column - categorical sequence in factor format.

Value

List of dataframes for each sequence separated by time window.

Examples

1
2
3
4
df<-data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34" , "2020-01-01 06:38:09",
"2020-01-01 07:21:51"),Cat=c('A','B','A','C'))
#For daily data:
SeqList(df,'%Y-%m-%d')

jgillam13/IRASD documentation built on Feb. 10, 2021, 9:38 a.m.