在R包'timetk'中,如何理解函数'diff_vec'中的参数'difference'?
library(timetk)
1:10 %>% diff_vec(lag=1)
#result: [1] NA 1 1 1 1 1 1 1 1 1
我试图改变“差异”的价值,但无法理解结果
#what's the usage of parameter 'difference'
1:10 %>% diff_vec(lag=1,difference = 1)
#result: [1] NA 1 1 1 1 1 1 1 1 1
1:10 %>% diff_vec(lag=1,difference = 2)
#result: [1] NA NA 0 0 0 0 0 0 0 0
1:10 %>% diff_vec(lag=1,difference = 3)
#result: [1] NA NA NA 0 0 0 0 0 0 0