test_that("SeqList is working correctly", {
df<-data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34" , "2020-01-02 06:38:09",
"2020-01-02 07:21:51"),Cat=c('A','B','A','C'))
df1<-list(data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34"),Cat=c('A','B')),
data.frame(Time=c("2020-01-02 06:38:09", "2020-01-02 07:21:51"),Cat=c('A','C')))
expect_equal(SeqList(df,'%Y-%m-%d'), df1)
df2<-data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34" , "2020-01-08 06:38:09",
"2020-01-08 07:21:51"),Cat=c('A','B','A','C'))
df3<-list(data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34"),Cat=c('A','B')),
data.frame(Time=c("2020-01-08 06:38:09", "2020-01-08 07:21:51"),Cat=c('A','C')))
expect_equal(SeqList(df2,"%Y-%W"),df3)
expect_equal(SeqList(df,"%Y-%W"),list(df))
df4<-data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34" , "2020-02-02 06:38:09",
"2020-02-02 07:21:51"),Cat=c('A','B','A','C'))
df5<-list(data.frame(Time=c("2020-01-01 00:10:09", "2020-01-01 01:12:34"),Cat=c('A','B')),
data.frame(Time=c("2020-02-02 06:38:09", "2020-02-02 07:21:51"),Cat=c('A','C')))
expect_equal(SeqList(df4,"%Y-%m"),df5)
expect_equal(SeqList(df,"%Y-%m"),list(df))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.