Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>[ @mnel beat me to it as I was writing ...]</p> <p>Almost certainly, one column of <code>set1</code> happens to be called <code>"id"</code>; i.e.,</p> <pre><code>isTRUE("id" %in% names(set1)) </code></pre> <p>causing <code>set1[J(id)]</code> to self join <code>set1$id</code> to <code>set1</code>, ignoring the <code>id</code> in calling scope.</p> <p>If so, there are several approaches to avoid scoping issues such as this :</p> <pre><code>.id = &lt;your 4M ids&gt; set1[J(.id)] </code></pre> <p>or use the fact that a single name <code>i</code> is evaluated in calling scope :</p> <pre><code>JDT=J(id); set1[JDT] </code></pre> <p>or that <code>eval</code> is <code>eval</code>'d in calling scope, too :</p> <pre><code>set1[eval(J(id))] </code></pre> <p>or, we do want to make this clearer, more robust and easier, so one thought is to add <code>..</code> :</p> <pre><code>set1[..(J(id))] # .. alias for eval </code></pre> <p>or perhaps :</p> <pre><code>set1[J(..id)] </code></pre> <p>where <code>..</code> borrows its meaning from the file system's <code>..</code>, meaning one-level-up. If the <code>..</code> was a prefix to symbols, you could then do something like :</p> <pre><code>DT[colB==..id] </code></pre> <p>where <code>==</code> is used there for illustration. In that example <code>colB</code> is expected to be a column name and <code>..id</code> will find <code>id</code> in calling scope (one level up). The thinking is that that would be quite clear to the reader of the code what the programmer intended.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload