2
dd = data.table(a = c(1,1), b = c(1,2), v = c(1, NA))
dd
# a b v
# 1: 1 1 1
# 2: 1 2 NA
setkey(dd, a,b)
dd[.(1,2), roll = TRUE, rollends = c(TRUE, TRUE)]
# a b v
# 1: 1 2 NA
我在這裏錯過了什麼?爲什麼v
沒有結轉?R data.table加入卷