<div>> t1 <- data.table(a=1:3,b=1/(1:3))</div><div>> t1[1,2]<- 99</div><div><br></div><div>Shouldn't this give an error? With with=T (the default), this doesn't make sense, and the resulting DT is not valid:</div>
<div><br></div><div>> t1</div><div>Error in data.table(lapply(x, function(x) { : </div><div> every input must have at least one value, unless all columns are empty</div><div><br></div><div>In fact, I'm not sure how to modify an individual cell in a DT:</div>
<div><br></div><div><div>> t1 <- data.table(a=1:3,b=1/(1:3))</div><div>> t1[1,2,with=F]<- 99</div><div>Error in `[<-.data.table`(`*tmp*`, 1, 2, with = F, value = 99) : </div><div> unused argument(s) (with = F)</div>
</div><div><br></div><div>On the other hand, you can apparently modify an entire column:</div><div><br></div><div><div>t1 <- data.table(a=1:3,b=1/(1:3))</div><div>> t1$b <- 11:13</div><div>> t1</div><div> a b</div>
<div>[1,] 1 11</div><div>[2,] 2 12</div><div>[3,] 3 13</div></div><div><br></div><div>And modifying a key column very sensibly makes it no longer a key:</div><div><br></div><div><div>> t2 <- data.table(a=1:3,b=1/(1:3),key="a")</div>
<div>> key(t2)</div><div>[1] "a"</div><div>> t2$a <- 11:13</div><div>> key(t2)</div><div>NULL</div></div><div><br></div>