data.table在PowerPC和SPARC上的不正确行为(均为big-endian)

data.table在PowerPC和SPARC上的不正确行为(均为big-endian),r,data.table,R,Data.table,有一个data.tabledt,其中我使用cut进行了一些分类: require(data.table) set.seed(1) dt <- data.table(x = rnorm(10)) dt[, y := cut(x, breaks = c(-Inf, 0, Inf), labels = 1:2)] 尝试再次设置密钥,但没有帮助: setkey(dt, z) ## Warning message: ## In setkeyv(x, cols, verbose = verbose)

有一个data.table
dt
,其中我使用
cut
进行了一些分类:

require(data.table)
set.seed(1)
dt <- data.table(x = rnorm(10))
dt[, y := cut(x, breaks = c(-Inf, 0, Inf), labels = 1:2)]
尝试再次设置密钥,但没有帮助:

setkey(dt, z)
## Warning message:
## In setkeyv(x, cols, verbose = verbose) :
##   Already keyed by this key but had invalid row order, key rebuilt. If you didn't go under the hood please let datatable-help know so the root cause can be fixed.

dt
##              x y z
##  1:  0.1836433 2 2
##  2:  1.5952808 2 2
##  3:  0.3295078 2 2
##  4:  0.4874291 2 2
##  5:  0.7383247 2 2
##  6:  0.5757814 2 2
##  7: -0.6264538 1 1
##  8: -0.8356286 1 1
##  9: -0.8204684 1 1
## 10: -0.3053884 1 1

dt[J(1)] # doesn't work
##     x  y z
## 1: NA NA 1
矢量扫描正在工作,因为不需要密钥。使用
as.numeric(as.character(y))
也可以。也许
[
-运算符在
as.Numeric
中是个问题?在dt 1.8.10中使用相同的代码与预期的一样。要找出代码在1.9.3中不再工作的原因并不容易

问题: 这是虫子吗

p、 s:

现在修复。感谢您的报道

与big-endian计算机(如SPARC和PowerPC)的兼容性已恢复。大多数Windows、Linux和Mac系统都是little-endian;请键入
。Platform$endian
进行确认。感谢Gerhard Nachmann的报告和PowerPC模拟器


谢谢,但我无法复制它。在Rv3.0.3和v3.1.0上使用1.9.3进行了测试,OS X Mountain Lion运行良好。我看到
z
是从
str
输出按降序排序的。所以很清楚为什么它不工作(续)…我将不得不问你一些事情。1)你能粘贴运行
test.data.table()
?运行
1.9.2+R v3.1.0
1.9.3+R v3.0.3
?3)时出现的错误号吗?另外,运行
setkey(dt,z)
(包括警告消息,如果有的话)两次?谢谢。是的,它的顺序是错误的。我在原始帖子中在
setkey(dt,z)
之后添加了
dt
。它又在1.9.5中工作了。谢谢!另请参阅
setkey(dt, z)
## Warning message:
## In setkeyv(x, cols, verbose = verbose) :
##   Already keyed by this key but had invalid row order, key rebuilt. If you didn't go under the hood please let datatable-help know so the root cause can be fixed.

dt
##              x y z
##  1:  0.1836433 2 2
##  2:  1.5952808 2 2
##  3:  0.3295078 2 2
##  4:  0.4874291 2 2
##  5:  0.7383247 2 2
##  6:  0.5757814 2 2
##  7: -0.6264538 1 1
##  8: -0.8356286 1 1
##  9: -0.8204684 1 1
## 10: -0.3053884 1 1

dt[J(1)] # doesn't work
##     x  y z
## 1: NA NA 1
sessionInfo()
## R version 3.1.0 (2014-04-10)
## Platform: powerpc64-unknown-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] splines   grid      stats     graphics  grDevices utils     datasets 
## [8] methods   base     

## other attached packages:
##  [1] plyr_1.8.1        reshape2_1.4      lubridate_1.3.3   HP14int_0.1-15   
##  [5] Hmisc_3.14-4      Formula_1.1-1     survival_2.37-7   lattice_0.20-29  
##  [9] HP14unidata_1.1-1 data.table_1.9.3 

## loaded via a namespace (and not attached):
## [1] cluster_1.15.2      digest_0.6.4        latticeExtra_0.6-26
## [4] memoise_0.2.1       RColorBrewer_1.0-5  Rcpp_0.11.1        
## [7] stringr_0.6.2       tools_3.1.0

writeLines(paste("Endianess:", .Platform$endian))
## Endianess: big