<div dir="ltr">Thanks for this, I knew not knowing how to do that join was a problem with me not understanding data.table, not a problem with data.table.<div><br><div>Very good to know the 'bysubl' "error" is fixed in 1.9.3 (even if it is brought about by users like me trying to do our joins wrongly :))</div>
<div><br></div><div>thanks,</div><div>Amy</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 20 June 2014 11:18, Arunkumar Srinivasan <span dir="ltr"><<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><p>Hi Amy,</p>

<p>Good to know that it’s not reproducible in 1.9.3. Matt already fixed it.</p>

<p><code>X[Y, LHS := RHS]</code> can not exceed <code>nrow(X)</code> because this assignment is made <em>by reference</em>. If the join from <code>X[Y]</code> results in more than <code>nrow(X)</code>, then <code>X</code> will be to be re-allocated entirely.</p>


<p>If you only want those that match with <code>X</code>, then you should do: <code>X[Y, female := i.female, nomatch=0L]</code>.</p>

<p>If instead you want all the rows from <code>y</code>, then you could do: <code>x[y, allow.cartesian=TRUE]</code>.</p>

<p></p><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <div><div style="font-family:helvetica,arial;font-size:13px">Arun</div></div> <div style="color:black">
<br>From: <span style="color:black">Amy</span> <a href="mailto:mathematical.coffee@gmail.com" target="_blank">mathematical.coffee@gmail.com</a><br>Reply: <span style="color:black">Amy</span> <a href="mailto:mathematical.coffee@gmail.com" target="_blank">mathematical.coffee@gmail.com</a><br>
Date: <span style="color:black">June 20, 2014 at 3:01:50 AM</span><br>To: <span style="color:black">Arunkumar Srinivasan</span> <a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a><br>Cc: <span style="color:black"><a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a></span> <a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><div>
<div class="h5"><br>Subject: <span style="color:black"> Re: [datatable-help] What is going on with R 3.1 ? <br></span></div></div></div><div><div class="h5"><br> <blockquote type="cite"><span><div><div></div><div>





<div dir="ltr">Hi Arun,
<div><br></div>
<div>In 1.9.3 I get the "Error in vecseq(f__, len__, if
(allow.cartesian) NULL else as.integer(max(nrow(x), : Join results
in 33 rows; more than 28 = max(nrow(x),nrow(i))...." message and it
doesn't assign the column (upon `x[y, female:=female]`, so no, the
error doesn't occur.</div>
<div><br></div>
<div>But as an aside, shouldn't it this command work?</div>
<div>If I have x with subjects a, a, b, c, d; y with genders for
subjects a--f, shouldn't x[y, female:=female] copy the female
column from y to x, duplicating as necessary?</div>
<div>Of course y[x] produces the table I'm after, but in the case
that y has extra columns I /don't/ want in the output and x has
extra columns I /do/, `y[x]` is then not the table I'm after. (But
now we are straying into a different question, my limited
understanding of how to use data.table, as opposed to the bug this
thread is about).</div>
<div><br></div>
<div>PS - typo on the data.table Readmein the "if you get latex
errors during installation" bit:</div>
<div><br></div>
<div>devtools:::install_github("datat.able", ...)</div>
<div><br></div>
<div>"datat.able" --> "data.table".</div>
<div><br></div>
<div>cheers</div>
<div>Amy</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 20 June 2014 10:51, Arunkumar
Srinivasan <span dir="ltr"><<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<p>Hi,</p>
<p>Could you let us know if you’re able to reproduce it in the
<a href="https://github.com/Rdatatable/data.table" target="_blank">devel version 1.9.3</a> as well?</p>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">
<br></div>
<div>
<div style="font-family:helvetica,arial;font-size:13px">Arun</div>
</div>
<div style="color:black"><br>
From: <span style="color:black">mathematical.coffee</span>
<a href="mailto:mathematical.coffee@gmail.com" target="_blank">mathematical.coffee@gmail.com</a><br>
Reply: <span style="color:black">mathematical.coffee</span>
<a href="mailto:mathematical.coffee@gmail.com" target="_blank">mathematical.coffee@gmail.com</a><br>
Date: <span style="color:black">June 20, 2014 at 2:44:50
AM</span><br>
To: <span style="color:black"><a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a></span>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
Subject:  <span style="color:black">Re: [datatable-help] What
is going on with R 3.1 ?<br></span></div>
<br>
<blockquote type="cite">
<div>
<div><span>Hi all,<br>
<br>
Sorry to resurrect an old thread, but I've been experiencing these
problems<br>
too and have come up with a reproducible example (for me
anyway).<br>
<br>
Data.table 1.9.2, R 3.1.0<br>
<br>
I was trying to join some tables and got the usual "rerun
with<br>
allow.cartesian=TRUE" message like Michele, and then got this
error:<br>
<br>
Error in if (!is.null(lhs)) { : missing value where TRUE/FALSE
needed<br>
<br>
However while I was trying to strip down my data to reproduce the
error, I<br>
now consistently get this one instead:<br>
<br>
Error in `[.data.table`(x, y, `:=`(female, female)) :<br>
object 'bysubl' not found<br>
<br>
<br>
rather than the TRUE/FALSE one. But they seem to be related.<br>
<br>
* x has a column of subjects, some duplicated<br>
* y has a column of subjects, none duplicated, and some not present
in x<br>
(all subjects of x are in y though).<br>
* y additionally has a binary column `female` that I wish to join
into x<br>
<br>
(I know there are other ways to do this, but this is a stripped
down example<br>
and seems to point out something going wrong in data.table so it is
just an<br>
illustrative example):<br>
<br>
```<br>
library(data.table)<br>
x=fread('x.csv')<br>
y=fread('y.csv')<br>
setkey(x, subject)<br>
setkey(y, subject)<br>
<br>
x[y]<br>
# Error in vecseq(f__, len__, if (allow.cartesian) NULL else<br>
as.integer(max(nrow(x), :<br>
# Join results in 33 rows; more than 28 = max(nrow(x),nrow(i)).
Check for<br>
duplicate key values in i, each of which join to the same group in
x over<br>
and over again. If that's ok, try including `j` and dropping
`by`<br>
(by-without-by) so that j runs for each group to avoid the large
allocation.<br>
If you are sure you wish to proceed, rerun with
allow.cartesian=TRUE.<br>
Otherwise, please search for this error message in the FAQ, Wiki,
Stack<br>
Overflow and datatable-help for advice.<br>
<br>
x[y, female:=female]<br>
Error in `[.data.table`(x, y, `:=`(female, female)) :<br>
object 'bysubl' not found<br>
```<br>
<br>
I get the above reproducibly with this dataset.<br>
<br>
>From now onwards, if I type in 'x' or 'y' into the prompt I get
nothing<br>
printed at all. Additionally:<br>
<br>
```<br>
tables()<br>
# Error in gettext(domain, unlist(args)) : invalid 'string'
value<br>
# Error: argument "finally" is missing, with no default<br>
```<br>
<br>
The only solution is to restart the R session.<br>
<br>
Note: this *doesn't* occur if the column I try to merge (`female`
in this<br>
case) is continuous, for example. I can only get it if it's
logical.<br>
<br>
I've attached x.csv and y.csv to this email for you to play
with.<br>
<br>
I think it might be possible to strip down the tables to less rows
(x has<br>
28, y has 26) but in my (not exhaustive) attempts to do so, I
didn't get<br>
this particular error.<br>
<br>
x.csv <<a href="http://r.789695.n4.nabble.com/file/n4692401/x.csv" target="_blank">http://r.789695.n4.nabble.com/file/n4692401/x.csv</a>><br>

y.csv <<a href="http://r.789695.n4.nabble.com/file/n4692401/y.csv" target="_blank">http://r.789695.n4.nabble.com/file/n4692401/y.csv</a>><br>

<br>
<br>
<span><font color="#888888"><br>
--<br>
View this message in context: <a href="http://r.789695.n4.nabble.com/What-is-going-on-with-R-3-1-tp4689002p4692401.html" target="_blank">http://r.789695.n4.nabble.com/What-is-going-on-with-R-3-1-tp4689002p4692401.html</a><br>


Sent from the datatable-help mailing list archive at
Nabble.com.<br>
_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
<a 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>
</font></span></span></div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br></div>


</div></div></span></blockquote><p></p></div></div></div></blockquote></div><br></div>