gpt4 book ai didi

r - 当measure.vars包含不在data.table中的变量时,melt.data.table可能会崩溃

转载 作者:行者123 更新时间:2023-12-03 15:44:44 24 4
gpt4 key购买 nike

以下代码在我的安装中崩溃:

library(data.table)
library(reshape2)
x = data.table(a=c(1,2),b=c(2,3),c=c(3,4))
melt(x,id.vars="a") # OK
melt(x,id.vars="a",measure.vars=c("c","d")) # Crashes

消息如下:
*** caught segfault ***
address 0x21000038, cause 'memory not mapped'
Traceback:
1: melt.data.table(x, id.vars = "a", measure.vars = c("c", "d"))
2: melt(x, id.vars = "a", measure.vars = c("c", "d"))

这是sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)

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

attached base packages:
[1] stats graphics grDevices utils datasets methods base
> library(data.table)
data.table 1.9.2 For help type: help("data.table")
> library(reshape2)
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)

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

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

other attached packages:
[1] reshape2_1.4 data.table_1.9.2

loaded via a namespace (and not attached):
[1] plyr_1.8.1 Rcpp_0.11.1 stringr_0.6.2

这里可能报告了相同的问题: melting data.table seems to crash RStudio?

最佳答案

感谢您的发布和错误报告。现在,此问题已通过v1.9.3的commit 1261修复。从NEWS:

  • melt now returns friendly error when meaure.vars are not in data instead of segfault. Closes #699. Thanks to vsalmendra for this post on SO and the subsequent bug report.


如果问题仍然存在,请回信。

关于r - 当measure.vars包含不在data.table中的变量时,melt.data.table可能会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24326797/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com