为什么head
和tail
工作不同data.table
?是设计使然吗?
> head(data.frame(x=1:10), -2)
x
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
> head(data.table(x=1:10), -2)
Error in seq_len(min(n, nrow(x))) :
argument must be coercible to non-negative integer
> tail(data.table(x=1:10), -2)
x
1: NA
2: NA
3: NA
4: 10
> tail(data.frame(x=1:10), -2)
x
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10