[datatable-help] .SD is locked

Michael Nelson michael.nelson at sydney.edu.au
Mon Nov 18 00:11:30 CET 2013


I don't believe this is to be expected.

A bug report should be filed (it is present in 1.8.10 on CRAN as well)

.SD is locked so you can't "mess" with it within a call to `[.data.table`, but this "locked" status should not be retained following the completion of that call


________________________________________
From: datatable-help-bounces at lists.r-forge.r-project.org [datatable-help-bounces at lists.r-forge.r-project.org] on behalf of G See [gsee000 at gmail.com]
Sent: Monday, 18 November 2013 9:32 AM
To: datatable-help at lists.r-forge.r-project.org
Subject: [datatable-help] .SD is locked

Hi,

Is the following error expected?

> library(data.table)
data.table 1.8.11  For help type: help("data.table")
> x <- as.data.table(BOD)
> xx <- x[, .SD, .SDcols="Time"]
> xx[, Time:=as.numeric(Time)]
Error in `[.data.table`(xx, , `:=`(Time, as.numeric(Time))) :
  .SD is locked. Using := in .SD's j is reserved for possible future
use; a tortuously flexible way to modify by group. Use := in j
directly to modify by group by reference.
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] data.table_1.8.11

loaded via a namespace (and not attached):
[1] plyr_1.8       reshape2_1.2.2 stringr_0.6.2


Thanks,
Garrett
_______________________________________________
datatable-help mailing list
datatable-help at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help


More information about the datatable-help mailing list