setkeyv与data.table中的异常错误 [英] Unusual error in setkeyv with data.table
本文介绍了setkeyv与data.table中的异常错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我会让自己非常熟悉 data.table
,但在 setkeyv
中遇到一个奇怪的错误,
错误很简单:
<$> c $ c> keycols <-c(A,B)
DT < - data.table(A = 1:10,B = 91:90)
setkeyv )
#setkeyv(x,cols,verbose = verbose,physical = physical)中的错误:
传递给.Internal(nchar)的4个参数,需要3
作为参考,这是我的 sessionInfo()
:
R版本3.2.0(2015-04-16)
平台:x86_64-w64-mingw32 / x64(64位)
运行时:Windows 7 x64(build 7601)Service Pack 1
locale:
[1] LC_COLLATE = English_United States.1252 LC_CTYPE = English_United States.1252 LC_MONETARY = English_United States.1252
[4] LC_NUMERIC = C LC_TIME = English_United States.1252
附加的基本包:
[1] stats graphics grDevices utils数据集方法base
其他软件包:
[1] cvTools_0.3.2 robustbase_0.92-4 lattice_0.20-31 kernlab_0.9-20 rstan_2.6.0 inline_0.3.14 Rcpp_0.11.6 data.table_1.9.4
通过命名空间(而不是附加):
[1] chron_2.3-47 grid_3.2.0 plyr_1.8.3 stats4_3.2.0 magrittr_1.5 stringi_0.5-4 reshape2_1.4.1 tools_3.2.0 stringr_1.0.0
[10] DEoptimR_1.0-2
解决方案没有解释为什么是这种情况,但升级到R 3.2.1和安装最新版本的每个包解决了问题。作为参考,这是我更新后的
sessionInfo()
: R版本3.2.1(2015-06-18)
平台:x86_64-w64-mingw32 / x64(64位)
运行环境:Windows 7 x64(build 7601)Service Pack 1
locale:
[1] LC_COLLATE = English_United States.1252 LC_CTYPE = English_United States.1252 LC_MONETARY = English_United States.1252
[4] LC_NUMERIC = C LC_TIME = English_United States.1252
附加的基本包:
[1] stats graphics grDevices utils数据集方法base
其他附加包:
[1] kernlab_0.9-20 rstan_2.6.0 inline_0.3.14 Rcpp_0.11.6 cvTools_0.3.2 robustbase_0.92-4 lattice_0.20-31 data.table_1.9.4
通过命名空间加载(未附加):
[1] chron_2 .3-47 grid_3.2.1 plyr_1.8.3 stats4_3.2.1 magrittr_1.5 stringi_0.5-4 reshape2_1.4.1 tools_3.2.1 stringr_1.0.0
[10] DEoptimR_1.0-2
I'd consdier myself very familiar with data.table
, but have encountered a strange error in the setkeyv
function that I can't sort out.
The error is very straightforward:
keycols<-c("A", "B")
DT <- data.table(A=1:10, B=91:90)
setkeyv(DT, keycols)
# Error in setkeyv(x, cols, verbose = verbose, physical = physical) :
# 4 arguments passed to .Internal(nchar) which requires 3
For reference, this is my sessionInfo()
:
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cvTools_0.3.2 robustbase_0.92-4 lattice_0.20-31 kernlab_0.9-20 rstan_2.6.0 inline_0.3.14 Rcpp_0.11.6 data.table_1.9.4
loaded via a namespace (and not attached):
[1] chron_2.3-47 grid_3.2.0 plyr_1.8.3 stats4_3.2.0 magrittr_1.5 stringi_0.5-4 reshape2_1.4.1 tools_3.2.0 stringr_1.0.0
[10] DEoptimR_1.0-2
解决方案
I have no explanation for why this is the case, but upgrading to R 3.2.1 and installing the latest version of every package resolves the issue. For reference, this is my sessionInfo()
after updating:
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kernlab_0.9-20 rstan_2.6.0 inline_0.3.14 Rcpp_0.11.6 cvTools_0.3.2 robustbase_0.92-4 lattice_0.20-31 data.table_1.9.4
loaded via a namespace (and not attached):
[1] chron_2.3-47 grid_3.2.1 plyr_1.8.3 stats4_3.2.1 magrittr_1.5 stringi_0.5-4 reshape2_1.4.1 tools_3.2.1 stringr_1.0.0
[10] DEoptimR_1.0-2
这篇关于setkeyv与data.table中的异常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文