【发布时间】:2013-09-21 08:49:15
【问题描述】:
为什么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
【问题讨论】:
标签: r data.table