[datatable-help] Crash when assigning column.
Matthew Dowle
mdowle at mdowle.plus.com
Mon Jan 21 17:15:50 CET 2013
Great post, making it easy to answer ...
v1.8.7 on R-Forge has
this bug fix :
o := by group with 0 length RHS could crash in some
circumstances. Thanks to
Damien Challet for the reproducible example
using obfuscated data and
pinpointing the version that regressed.
Fixed and test added.
Matthew
On 21.01.2013 15:41, Ricky Saporta
wrote:
> Hello,
> When attempting to run the line of code below, R
crashes.
> I tried it on two systems with same results.
> Any thoughts
as to why the crash (as opposed to say an error)?
> Thanks for any help
and insight
> --
> Ricardo Saporta
> Graduate Student, Data Analytics
> Professional Science Masters
> Rutgers University, New Jersey
> e:
saporta at rutgers.edu [1]
> #---- SAMPLE DATA -------#
>
library(data.table)
> test.dt
> ID = c(4089L, 4090L, 4090L, 4091L,
4091L, 4092L, 4092L,
> 4093L, 4093L, 4093L, 4094L, 4094L, 4094L),
>
name = c("A", "B", "C", "D", "E", "F", "G", "H",
> "I", "J", "K", "L",
"M"),
> order = list("A", c("B", "C"), c("B", "C"), c("D", "E"),
>
c("D", "E"), c("F", "G"), c("F", "G"),
> c("H", "I", "J"), c("H", "I",
"J"),
> c("H", "I", "J"),c("K", "L", "M"),
> c("K", "L", "M"), c("K",
"L", "M"))),
> .Names = c("ID", "name", "order"), row.names = c(NA,
-13L),
> class = c("data.table", "data.frame"))
> #---- OFFENDING LINE
-------#
> # this line causes R to crash.
> test.dt[, tc :=
which(name==order), by=list(ID, name)]
> # this is the line that I
should have used
> test.dt[, tc := which(name == order[[1]]),
by=list(ID, name)]
> #---- SESSION INFO -------#
> ## SYSTEM 1:
> >
sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform:
x86_64-pc-linux-gnu (64-bit)
> locale:
> [1] LC_CTYPE=en_US.UTF-8
LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C
> [6] LC_MESSAGES=C
LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
> [11]
LC_MEASUREMENT=C LC_IDENTIFICATION=C
> attached base packages:
> [1]
stats graphics grDevices utils datasets methods base
> other attached
packages:
> [1] rbenchmark_1.0.0 stringr_0.6.1 data.table_1.8.6
RMySQL_0.9-3 DBI_0.2-5
> loaded via a namespace (and not attached):
>
[1] plyr_1.7.1 tools_2.15.2
> ## SYSTEM 2:
>> sessionInfo()
> R
version 2.15.1 (2012-06-22)
> Platform: x86_64-apple-darwin9.8.0/x86_64
(64-bit)
> locale:
> [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
attached base packages:
> [1] stats graphics grDevices utils datasets
methods base
> other attached packages:
> [1] data.table_1.8.6
>>
Links:
------
[1] mailto:saporta at rutgers.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130121/c46d640c/attachment.html>
More information about the datatable-help
mailing list