I want to identify temporal patterns in a time series.
structure(list(ID = c("a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
"v", "w", "x"), 2016/01
= c(1, NA, NA, 1, NA, NA, 1, NA, NA,
1, NA, 1, 1, 1, NA, 1, NA, NA, 1, NA, NA, 1, NA, NA), 2016/02
= c(NA,
1, NA, NA, 1, NA, NA, 1, NA, NA, 1, 1, 1, NA, 1, NA, 1, NA, NA,
1, NA, NA, 1, NA), 2016/03
= c(NA, NA, 1, NA, NA, 1, NA, NA,
1, 1, NA, 1, 1, 1, NA, NA, NA, 1, NA, NA, 1, NA, NA, 1), 2016/04
= c(NA,
NA, NA, 1, NA, NA, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA,
1, NA, NA, NA, NA, NA), 2016/05
= c(NA, NA, NA, NA, 1, NA,
NA, NA, NA, 1, NA, 1, 1, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA,
NA), 2016/06
= c(NA, NA, NA, NA, NA, 1, NA, NA, NA, NA, 1,
1, 1, NA, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA), 2016/07
= c(NA,
NA, NA, 1, NA, NA, 1, NA, NA, 1, NA, 1, 1, 1, NA, 1, NA, NA,
1, NA, NA, NA, NA, NA), 2016/08
= c(NA, NA, NA, NA, 1, NA,
NA, 1, NA, NA, 1, 1, 1, NA, 1, NA, 1, NA, NA, 1, NA, NA, NA,
NA), 2016/09
= c(NA, NA, NA, NA, NA, 1, NA, NA, 1, 1, NA, 1,
1, 1, NA, NA, NA, 1, NA, NA, 1, NA, NA, NA), 2016/10
= c(NA,
NA, NA, 1, NA, NA, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA,
1, NA, NA, NA, NA, NA), 2016/11
= c(NA, NA, NA, NA, 1, NA,
NA, NA, NA, 1, NA, 1, 1, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA,
NA), 2016/12
= c(NA, NA, NA, NA, NA, 1, NA, NA, NA, NA, 1,
1, 1, NA, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA), 2017/01
= c(1,
NA, NA, 1, NA, NA, 1, NA, NA, 1, NA, 1, 1, 1, NA, 1, NA, NA,
1, NA, NA, 1, NA, NA), 2017/02
= c(NA, 1, NA, NA, 1, NA, NA,
1, NA, NA, 1, 1, 1, NA, 1, NA, 1, NA, NA, 1, NA, NA, 1, NA),
2017/03
= c(NA, NA, 1, NA, NA, 1, NA, NA, 1, 1, NA, 1,
1, 1, NA, NA, NA, 1, NA, NA, 1, NA, NA, 1), 2017/04
= c(NA,
NA, NA, 1, NA, NA, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA,
NA, 1, NA, NA, NA, NA, NA), 2017/05
= c(NA, NA, NA, NA,
1, NA, NA, NA, NA, 1, NA, 1, 1, 1, NA, NA, NA, NA, NA, 1,
NA, NA, NA, NA), 2017/06
= c(NA, NA, NA, NA, NA, 1, NA,
NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA, NA, NA, 1, NA, NA,
NA), 2017/07
= c(NA, NA, NA, 1, NA, NA, 1, NA, NA, 1, NA,
1, 1, 1, NA, 1, NA, NA, 1, NA, NA, NA, NA, NA), 2017/08
= c(NA,
NA, NA, NA, 1, NA, NA, 1, NA, NA, 1, 1, 1, NA, 1, NA, 1,
NA, NA, 1, NA, NA, NA, NA), 2017/09
= c(NA, NA, NA, NA,
NA, 1, NA, NA, NA, 1, NA, 1, 1, 1, NA, NA, NA, NA, NA, NA,
1, NA, NA, NA), 2017/10
= c(NA, NA, NA, 1, NA, NA, NA,
NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA, 1, NA, NA, NA, NA,
NA), 2017/11
= c(NA, NA, NA, NA, 1, NA, NA, NA, NA, 1,
NA, 1, 1, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA, NA), 2017/12
= c(1,
NA, NA, NA, NA, 1, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA,
NA, NA, NA, 1, 1, NA, NA), 2018/01
= c(NA, 1, NA, 1, NA,
NA, 1, NA, NA, 1, NA, 1, 1, 1, NA, 1, NA, NA, 1, NA, NA,
NA, 1, NA), 2018/02
= c(NA, NA, 1, NA, 1, NA, NA, 1, NA,
NA, 1, 1, 1, NA, 1, NA, 1, NA, NA, 1, NA, NA, NA, 1), 2018/03
= c(NA,
NA, NA, NA, NA, 1, NA, NA, 1, 1, NA, 1, 1, 1, NA, NA, NA,
1, NA, NA, 1, NA, NA, NA), 2018/04
= c(NA, NA, NA, 1, NA,
NA, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA, 1, NA, NA,
NA, NA, NA), 2018/05
= c(NA, NA, NA, NA, 1, NA, NA, NA,
NA, 1, NA, 1, 1, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA, NA
), 2018/06
= c(NA, NA, NA, NA, NA, 1, NA, NA, NA, NA, 1,
1, 1, NA, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA), 2018/07
= c(NA,
NA, NA, 1, NA, NA, 1, NA, NA, 1, NA, 1, 1, 1, NA, 1, NA,
NA, 1, NA, NA, NA, NA, NA), 2018/08
= c(NA, NA, NA, NA,
1, NA, NA, 1, NA, NA, 1, 1, 1, NA, 1, NA, 1, NA, NA, 1, NA,
NA, NA, NA), 2018/09
= c(NA, NA, NA, NA, NA, 1, NA, NA,
1, 1, NA, 1, 1, 1, NA, NA, NA, 1, NA, NA, 1, NA, NA, NA),
2018/10
= c(NA, NA, NA, 1, NA, NA, NA, NA, NA, NA, 1, 1,
1, NA, 1, NA, NA, NA, 1, NA, NA, NA, NA, NA), 2018/11
= c(NA,
NA, NA, NA, 1, NA, NA, NA, NA, 1, NA, 1, 1, 1, NA, NA, NA,
NA, NA, 1, NA, NA, NA, NA), 2018/12
= c(NA, NA, NA, NA,
NA, 1, NA, NA, NA, NA, 1, 1, 1, NA, 1, NA, NA, NA, NA, NA,
1, NA, NA, NA)), row.names = c(NA, -24L), class = c("tbl_df",
"tbl", "data.frame"))
In the upper dataframe indivuidual:
- List item
a has the same pattern as v
b has the same pattern as w
c has the same pattern as x
In the upper dataframe indivuiduals a, b, c, v, w and x have the same frequency - yearly.
The are some other cases as bimensal, quartlerly and semestral.
My objetive is to identify all this cases and classify all individuals with a time pattern.
I suppose that the package arulesSequences can be useful.
Can you help me please?