<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><br>
The default argument to nomatch is `'getOption("datatable.nomatch")`. The default value for this is `NA`.
<div><br>
</div>
<div>If you want to change this option, simply set `options(datatable.nomatch = 0)`, then the default will be as you want.</div>
<div><br>
</div>
<div>I think the current datatable.nomatch = NA is reasonable, as you are often interested in non-matches as well as matches.</div>
<div><br>
</div>
<div>x[y, nomatch=NA] to give a error in your case, then follow the advice of the error message and run</div>
<div><br>
</div>
<div>x[y, nomatch=NA, allow.cartesian = TRUE]</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF260563" style="direction: ltr;"><font face="Tahoma" size="2" color="#000000"><b>From:</b> datatable-help-bounces@lists.r-forge.r-project.org [datatable-help-bounces@lists.r-forge.r-project.org] on behalf of Frank Erickson [FErickson@psu.edu]<br>
<b>Sent:</b> Monday, 14 October 2013 1:03 PM<br>
<b>To:</b> data.table source forge<br>
<b>Subject:</b> [datatable-help] possible FR: in x[y], switch to nomatch=0 instead of failing with "Error in vecseq..."<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">I don't know if this error shows up in other cases, but I always see it when I'm about to do
<div><br>
</div>
<div><font face="courier new, monospace">x[y,b:=b]</font></div>
<div><br>
</div>
<div>but first want to check how </div>
<div><br>
</div>
<div><font face="courier new, monospace">x[y]</font></div>
<div><br>
</div>
<div>looks before creating or overwriting x$b. Here's an example:</div>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">x <- data.table(a=rep(2:3,2),key='a')</font></div>
<div><font face="courier new, monospace">y <- data.table(a=1:4,b=4:1,key='a')</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">x[y] # error</font></div>
</div>
<div><font face="courier new, monospace">x[y,nomatch=0] # ok<br>
</font></div>
<div><font face="courier new, monospace">x[y,b:=b] # ok</font></div>
<div><br>
</div>
<div>I'd prefer to see the first attempt mapped to the second (with a suitable message), instead of erroring out. What do you all think? Is that reasonable/worthwhile?</div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>Frank</div>
<div><br>
</div>
<div>
<div>P.S. One other point, regarding the message itself (reproduced down below): I don't understand why repeated values in i are mentioned.</div>
<div><br>
</div>
<div>-- For x[y] in my example, the problem seems to be coming from x having repeated rows, not i (y in this case); </div>
<div>-- whereas y[x] works just fine (despite the repeated/duplicated values in i...which is x here).</div>
</div>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">Error in vecseq(f__, len__, if (allow.cartesian) NULL else as.integer(max(nrow(x), : </font></div>
<div><font face="courier new, monospace"> Join results in 6 rows; more than 4 = max(nrow(x),nrow(i)). Check for duplicate key values in i, each of which join to the same group in x over and over again. If that's ok, try including `j` and dropping `by` (by-without-by)
so that j runs for each group to avoid the large allocation. If you are sure you wish to proceed, rerun with allow.cartesian=TRUE. Otherwise, please search for this error message in the FAQ, Wiki, Stack Overflow and datatable-help for advice.</font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>