我看到一个奇怪的问题,即使用:=从数据表中删除的列也会在先前创建的数据表的副本中删除。这是预期的吗?
> dt <- data.table(c1=c("a","b"), c2=c(1,2))
> dt
c1 c2
1: a 1
2: b 2
> dt2 <- dt
> names(dt2)
[1] "c1" "c2"
> names(dt)
[1] "c1" "c2"
> dt[,c1:=NULL] # Deleting Column c1 from dt
> names(dt)
[1] "c2"
> names(dt2) # Column c1 missing in dt2
[1] "c2"
我在Mac Mavericks(x86_64-apple-darwin10.8.0(64位))和data.table 1.8.10上使用R版本3.0.1(2013-05-16)。这可能很有用(?) -
data.table 1.8.10 For help type: help("data.table")
Warning message:
package ‘data.table’ was built under R version 3.0.2
谢谢,