[datatable-help] Ordering of filter expressions

Bacou, Melanie mel at mbacou.com
Mon Dec 15 21:30:10 CET 2014


I can reproduce in 1.9.4:

 > library(data.table)
data.table 1.9.4  For help type: ?data.table
*** NB: by=.EACHI is now explicit. See README to restore previous behaviour.
Warning message:
package 'data.table' was built under R version 3.1.1
 > d <- data.table(a=1:2, b=1:2)
 > d[round(a) == a]
    a b
1: 1 1
2: 2 2
 > d[a == round(a)]
Error in eval(expr, envir, enclos) : object 'a' not found

 > versionInfo()
Error: could not find function "versionInfo"
 > sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] data.table_1.9.4 rj_1.1.3-1

loaded via a namespace (and not attached):
[1] chron_2.3-45  plyr_1.8.1    Rcpp_0.11.3   reshape2_1.4 rj.gd_1.1.3-1
[6] stringr_0.6.2 tools_3.1.0


On 12/15/2014 9:53 AM, Arunkumar Srinivasan wrote:
> I can't reproduce this in 1.9.5 (current devel): 
> http://github.com/Rdatatable/data.table
>
> On Mon, Dec 15, 2014 at 3:26 PM, Johann Hibschman 
> <jhibschman at gmail.com <mailto:jhibschman at gmail.com>> wrote:
>
>     I finally had time to put together a minimal example:
>
>         > d <- data.table(a=1:2, b=1:2)
>         > d[round(a) == a]
>            a b
>         1: 1 1
>         2: 2 2
>         > d[a == round(a)]
>         Error in eval(expr, envir, enclos) : object 'a' not found
>
>     Is this a bug, or am I missing something about the scoping rules?
>
>     R 3.1.2, data.table 1.9.4, on Windows 7.
>
>     Thanks,
>     Johann
>
>     On Fri, Dec 12, 2014 at 10:18 AM, Johann Hibschman
>     <jhibschman at gmail.com <mailto:jhibschman at gmail.com>> wrote:
>     > I just ran into an issue where d[X==round(X)] gives different
>     results
>     > from d[round(X) == X]. Why would that happen?
>     >
>     > Here's the exact example:
>     >
>     >> z.dev[YIELD == round(YIELD),]
>     > Error in eval(expr, envir, enclos) : object 'YIELD' not found
>     >> z.dev[round(YIELD) == YIELD,]
>     >    runId dealName     cusip scenarioId shockId pathOrder PRICE100
>     > YIELD MOD_DURN MOD_CONVEXITY DISC_MARGIN SPREAD_BP
>     > 1: 10556 HVML0501 41161PLE1        772       0  3  54.5094
>     > 6    4.739         0.431         400       418
>     > 2: 10556 HVML0501 41161PLE1        773       0  3  52.9452
>     > 6    4.706         0.427         400       424
>     >
>     > Thanks,
>     > Johann
>     _______________________________________________
>     datatable-help mailing list
>     datatable-help at lists.r-forge.r-project.org
>     <mailto:datatable-help at lists.r-forge.r-project.org>
>     https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
>
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

-- 
Melanie BACOU
International Food Policy Research Institute
Snr. Program Manager, HarvestChoice
Work +1(202)862-5699
E-mail m.bacou at cgiar.org
Visit www.harvestchoice.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20141215/943680d1/attachment.html>


More information about the datatable-help mailing list