<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      Hi Mel,<br>
      <br>
      Thanks for the info.  It's likely related to cedta() and we can
      handle it from data.table's side as follows.<br>
      <br>
      Background :<br>
      <br>
          <a class="moz-txt-link-freetext" href="http://stackoverflow.com/a/10529888/403310">http://stackoverflow.com/a/10529888/403310</a><br>
      <br>
      Type "data.table:::cedta" so you can see the rules.  I guess
      FastWeb is running your code in its own environment.  First
      thing,  turn on verbosity :<br>
      <br>
          options(data.table.verbose=TRUE)     #  or for one statement
      rather than globally,   d1[d2,verbose=TRUE]<br>
      <br>
      and run your code again.  You should see a message  "cedta decided
      '<nsname>' wasn't data.table aware",  where <nsname>
      is probably "FastRWeb".<br>
      <br>
      This calling environment (let's assume "FastRWeb" from now on) is
      more like .GlobalEnv than a package;  i.e.,  it's where you run
      your own code, you've done library(data.table) in that
      environment,  and so it is data.table aware as far as you're
      concerned.  So what to do?  There are two override mechanisms :<br>
      <br>
      The data.table package contains a character vector :<br>
      <br>
      > data.table:::cedta.override<br>
      [1] "gWidgetsWWW"<br>
      <br>
      It already contains one package which is similar in nature.  You
      can add FastRWeb to that vector yourself as follows :<br>
      <br>
      > assignInNamespace("cedta.override",
      c("gWidgetsWWW","FastRWeb"), "data.table")<br>
      > data.table:::cedta.override<br>
      [1] "gWidgetsWWW" "FastRWeb"   <br>
      <br>
      But I'll also add FastRWeb to that vector in data.table, so from
      the next version of data.table you won't have to do it yourself. 
      We'll add new packages as we become aware of them.<br>
      <br>
      Alternatively,  the package author (Simon in this case) can
      provide data.table-awareness optionally.  This mechanism was added
      for dplyr so it can control data.table awareness from the caller's
      end.  That's done by setting a variable
      .datatable.aware=TRUE|FALSE in the calling package's namespace.   
      However, in the case of FastRWeb,  the cedta.override on
      data.table's side seems the right way to go.<br>
      <br>
      Matt<br>
      <br>
      <br>
      On 18/02/14 05:31, Bacou, Melanie wrote:<br>
    </div>
    <blockquote cite="mid:5302F047.6020404@mbacou.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Hi Arun,<br>
      <br>
      This is a little tricky to reproduce unless you have installed
      FastRWeb, and then started the FastRWeb server. I'm executing
      these scripts from the browser through a call to FastRWeb running
      on a local port.<br>
      <br>
      Installation is documented here and is quick and straightforward
      on Linux:<br>
      <a moz-do-not-send="true" href="https://rforge.net/FastRWeb/">https://rforge.net/FastRWeb/</a><br>
      and an example here:<br>
      <a moz-do-not-send="true"
href="http://jayemerson.blogspot.mx/2011/10/setting-up-fastrwebrserve-on-ubuntu.html">http://jayemerson.blogspot.mx/2011/10/setting-up-fastrwebrserve-on-ubuntu.html</a><br>
      <br>
      I'm using FastRWeb to build a simple web service. As long as I
      stick to data.frame methods, everything works fine and I get the
      expected plots and HTML output in the browser. But calls to
      data.table methods (merge, extract) all seem to default to
      data.frame, and I really don't know how to debug that.<br>
      <br>
      I am copying Simon Urbanek who's the maintainer of FastRWeb, in
      case this is more of a FastRWeb issue.<br>
      <br>
      Here is my session info (I am on CentOS 5 and cannot easily
      upgrade to R 3.0.2).<br>
      <br>
      > sessionInfo()<br>
      R version 2.15.2 (2012-10-26)<br>
      Platform: x86_64-redhat-linux-gnu (64-bit)<br>
      <br>
      locale:<br>
      [1] C<br>
      <br>
      attached base packages:<br>
      [1] stats     graphics  utils     datasets  grDevices methods  
      base     <br>
      <br>
      other attached packages:<br>
       [1] ggmap_2.3          ggplot2_0.9.3.1    RColorBrewer_1.0-5
      raster_2.2-12     <br>
       [5] rgeos_0.3-3        rgdal_0.8-16       sp_1.0-14         
      data.table_1.8.10 <br>
       [9] RJDBC_0.2-3        rJava_0.9-6        DBI_0.2-7         
      rj_1.1.2-3        <br>
      <br>
      loaded via a namespace (and not attached):<br>
       [1] MASS_7.3-23         RJSONIO_1.0-3       RgoogleMaps_1.2.0.5<br>
       [4] colorspace_1.2-4    dichromat_2.0-0     digest_0.6.4       <br>
       [7] grid_2.15.2         gtable_0.1.2        labeling_0.2       <br>
      [10] lattice_0.20-24     mapproj_1.2-2       maps_2.3-6         <br>
      [13] munsell_0.4.2       plyr_1.8            png_0.1-7          <br>
      [16] proto_0.3-10        reshape2_1.2.2      rj.gd_1.1.0-1      <br>
      [19] rjson_0.2.13        scales_0.2.3        stringr_0.6.2      <br>
      [22] tools_2.15.2    <br>
      <br>
      Thanks all!<br>
      --Mel.<br>
      <br>
      <br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 2/17/2014 6:58 AM, Arunkumar
        Srinivasan wrote:<br>
      </div>
      <blockquote
cite="mid:CAAf756O7Z+_J5Zrmcu3dpNVU6CKaS82Vitd-pPYB1iwUKMDhfA@mail.gmail.com"
        type="cite">
        <div dir="ltr">Mel,
          <div>I'm not able to reproduce this on 1.8.11. Which version
            are you using?</div>
          <div>I'm not aware of this package, and what 'otable' is
            supposed to do. But I get no output while running your
            script, and not the error message as well.</div>
        </div>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Mon, Feb 17, 2014 at 11:14 AM,
            Bacou, Melanie <span dir="ltr"><<a
                moz-do-not-send="true" href="mailto:mel@mbacou.com"
                target="_blank">mel@mbacou.com</a>></span> wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
                <br>
                I am testing an R script using FastRWeb (through
                Rserve). FastRWeb works as expected and I can
                successfully runs Simon Urbanek's examples. Problems
                arise when I try to merge datatables. It seems FastRWeb
                cannot find <tt>merge.data.table()</tt>.<br>
                <br>
                I'm using plenty of other libraries (ggplot, raster,
                RJDBC, etc.) that execute successfully through FastRWeb
                scripts, so I'm guessing it's something peculiar to
                data.table.<br>
                <br>
                Thanks for any help! --Mel.<br>
                <br>
                <br>
                Here are reproducible examples.<br>
                <br>
                Test #1: the code below (the entire content of my R
                script) SUCCEEDS:<br>
                <br>
                <tt># test1.R</tt><tt><br>
                </tt><tt>library(data.table)</tt><tt><br>
                </tt><tt><br>
                </tt><tt>run <- function(...) {</tt><tt><br>
                    oclear()<br>
                </tt><tt>  d1 <- data.table(a=c(1,2,3),
                  b=c("a","b","c"))</tt><tt><br>
                </tt><tt>  d2 <- data.table(e=c("v","a","b"),
                  f=c(4,6,7))</tt><tt><br>
                </tt><tt>  otable(d1)</tt><tt><br>
                </tt><tt>  otable(d2)</tt><tt><br>
                </tt><tt>}</tt><br>
                <br>
                This returns a simple web page showing 2 tables:<br>
                <table style="font-family:'Times New
Roman';letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px">
                  <tbody>
                    <tr>
                      <td>1</td>
                      <td>a</td>
                    </tr>
                    <tr>
                      <td>2</td>
                      <td>b</td>
                    </tr>
                    <tr>
                      <td>3</td>
                      <td>c</td>
                    </tr>
                  </tbody>
                </table>
                <table style="font-family:'Times New
Roman';letter-spacing:normal;text-indent:0px;text-transform:none;word-spacing:0px">
                  <tbody>
                    <tr>
                      <td>v</td>
                      <td>4</td>
                    </tr>
                    <tr>
                      <td>a</td>
                      <td>6</td>
                    </tr>
                    <tr>
                      <td>b</td>
                      <td>7</td>
                    </tr>
                  </tbody>
                </table>
                <br>
                <br>
                Test #2: the code below (the entire content of my R
                script) FAILS with:<tt><span><br>
                    <tt>Error in `[.default`(x, i) : invalid subscript
                      type 'list'</tt></span></tt><br>
                <br>
                <tt># test2.R<br>
                </tt><tt> library(data.table)</tt><tt><br>
                </tt><tt> </tt><tt><br>
                </tt><tt> run <- function(...) {</tt><tt><br>
                    oclear()<br>
                </tt><tt>   d1 <- data.table(a=c(1,2,3),
                  b=c("a","b","c"))</tt><tt><br>
                </tt><tt>   d2 <- data.table(e=c("v","a","b"),
                  f=c(4,6,7))</tt><tt><br>
                </tt><tt>   otable(d1)</tt><tt><br>
                </tt><tt>   otable(d2)</tt><tt><br>
                </tt><tt>   setkey(d1, b)</tt><tt><br>
                </tt><tt>   setkey(d2, e)</tt><tt><br>
                </tt><tt>   otable(d1[d2])</tt><tt><br>
                </tt><tt> }</tt><span class="HOEnZb"><font
                    color="#888888"><br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <pre cols="72">-- 
Melanie BACOU
International Food Policy Research Institute
Agricultural Economist, HarvestChoice
Work <a moz-do-not-send="true" href="tel:%2B1%28202%29862-5699" value="+12028625699" target="_blank">+1(202)862-5699</a>
E-mail <a moz-do-not-send="true" href="mailto:mel@mbacou.com" target="_blank">mel@mbacou.com</a>
Visit <a moz-do-not-send="true" href="http://harvestchoice.org" target="_blank">harvestchoice.org</a> </pre>
                  </font></span></div>
              <br>
              _______________________________________________<br>
              datatable-help mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
              <a moz-do-not-send="true"
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help"
                target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Melanie BACOU
International Food Policy Research Institute
Agricultural Economist, HarvestChoice
Work +1(202)862-5699
E-mail <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:mel@mbacou.com">mel@mbacou.com</a>
Visit harvestchoice.org </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
datatable-help mailing list
<a class="moz-txt-link-abbreviated" href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></pre>
    </blockquote>
    <br>
  </body>
</html>