[datatable-help] Bug when Merging with nomatch=0 and roll=T?

Michael Smith my.r.help at gmail.com
Fri Jun 20 05:37:07 CEST 2014


So let me rephrase my question (haven't received an answer so far):

For a given data.table, is there any condition under which the lengths
of the vectors in each column may differ? Based on my understanding,
each data.table is also a data.frame, and with a data frame this should
not be possible. For example, it's not possible to have a data.frame
where the first column is a vector of length eight, and the second
column is a vector of length nine. Ergo, it's a bug, right?

If my understanding is correct, please do let me know and I'll be glad
to try to boil this down to something that's reproducible.

Thanks,
M

On 06/19/2014 11:59 AM, Michael Smith wrote:
> By the way, I know it's not reproducible with the code below. Before
> going into further detail, I first wanted to ask whether this looks like
> a bug, or whether I've overlooked something obvious and this is expected
> behavior.
> 
> Thanks,
> M
> 
> On 06/19/2014 11:51 AM, Michael Smith wrote:
>> I got the following result on my keyed data tables `CS` and `SP`, which
>> seems like a bug (in 1.9.2 and 1.9.3 dev version) to me, since all
>> columns should have the _same_ length:
>>
>>> ## Works as expected:
>>> all((l <- sapply(CS[SP, roll = TRUE], length)) == l[1])
>> [1] TRUE
>>> ## Works as expected:
>>> all((l <- sapply(CS[SP, nomatch = 0], length)) == l[1])
>> [1] TRUE
>>> ## Here's the potential _bug_, when combining both:
>>> all((l <- sapply(CS[SP, nomatch = 0, roll = TRUE], length)) == l[1])
>> [1] FALSE
>>
>>
>> Thanks,
>>
>> M
>>


More information about the datatable-help mailing list