数据表1.9.4禁止列自我过滤;新方法? [英] Data.table 1.9.4 prohibits column self-filtering; new methods?

查看:91
本文介绍了数据表1.9.4禁止列自我过滤;新方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在data.table-1.9.2中,允许使用以下语法:

  dt [some_column == max(some_column) ] 

这样可以对列本身进行精细,简单,快速的过滤。



现在在data.table-1.9.4上运行相同的代码时抛出以下错误

  object'some_column'not found 

我有两个问题。



1。)为什么要改变这个美丽的属性?这是很好的Matt Dowle在这里评论。



2。)有没有人有一些聪明的解决方案来替换这个方法?

之外的其他项

  new.var<  -  dt [,max(some_column)] 
dt [some_column == new.var]

请注意,



K

解决方案

最后一个二进制版本的CRAN为Mac SL分支是1.9.2这是我有,这不是问题:

 > d > d [a == max(a),] 
a
1:10

所以我得到了最新的CRAN源版本1.9.4,并在卸载pkg:data.table并重新加载后用这些结果编译:

 > d > d [a == max(a),] 
在`[.data.table`(d,a == max(a),)中出错
对象未找到CsubsetVector

重新启动后:

 > d > d [a == max(a),] 
eval(expr,envir,enclos)中的错误:object'a'not found

使用说明在Github 问题蒸发:

  require(data.table)
加载所需的软件包:data.table
data.table 1.9.5对于帮助类型:?data.table
*** NB:by = .EACHI现在显式。请参见README以恢复先前的行为。
> d [a == max(a),]
错误:找不到对象'd'
> d > d [a == max(a),]
a
1:10


In data.table-1.9.2 the following syntax was allowed:

dt[some_column == max(some_column)]

This allowed for nice, easy and fast filtering on the column itself.

Now on data.table-1.9.4 the following error is thrown running the same code

object 'some_column' not found

I have two questions.

1.) Why change this beautiful attribute?! It'd be nice of Matt Dowle to comment here.

2.) Does anyone have some clever solutions to replace this method? Something other than

new.var <- dt[, max(some_column)]
dt[some_column == new.var]

Regards,

K

解决方案

The last binary version on CRAN for Mac SL branch is 1.9.2 which is what I had, and as you say that is not a problem:

> d <- data.table(a=1:10)
> d[a==max(a),]
    a
1: 10

So I got the most recent CRAN source version 1.9.4 and compiled with these results after unloading pkg:data.table and reloading :

> d <- data.table(a=1:10)
> d[a==max(a),]
Error in `[.data.table`(d, a == max(a), ) 
  object 'CsubsetVector' not found

After restarting:

> d <- data.table(a=1:10)
> d[a==max(a),]
Error in eval(expr, envir, enclos) : object 'a' not found

After building 1.9.5 from source (Mac 3.1.2 SL branch) using the instructions at Github the problem evaporated:

> require(data.table)
Loading required package: data.table
data.table 1.9.5  For help type: ?data.table
*** NB: by=.EACHI is now explicit. See README to restore previous behavior.
> d[a==max(a),]
Error: object 'd' not found
> d <- data.table(a=1:10)
> d[a==max(a),]
    a
1: 10

这篇关于数据表1.9.4禁止列自我过滤;新方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆