It might help, specially where data.table is compared to SQL. However, I think that having merge (and maybe [.data.table) have an argument to avoid NA matching. Is there a FR already created for this? I can create it otherwise
On Thu, Sep 18, 2014 at 4:00 PM, Arunkumar Srinivasan <[email protected] > wrote: > In base R `NA` matches `NA` alone, and `NaN` matches `NaN` alone: > match(NA, c(1:5, NA)) > # [1] 6 > > data.table matches, through binary search, by design, in the same way. And > in `?match`, there's this line: "Exactly what matches what is to some > extent a matter of definition." In some operations it may not make sense. > But, by design, we do consider Inf = Inf, -Inf = -Inf, NaN = NaN and NA = > NA always. Do you think it'd help tp state this explicitly in `?data.table`? > > > Arun > > From: Juan Manuel Truppia <[email protected]> <[email protected]> > Reply: Juan Manuel Truppia <[email protected]>> <[email protected]> > Date: September 18, 2014 at 6:14:56 PM > To: [email protected] > <[email protected]>> > <[email protected]> > Subject: [datatable-help] NA in joins > > Hi, this must have been discussed before, but I couldn't find anything. > > In my opinion, NA shouldn't join with anything, including other NA (as to > mirror what we expect from SQL, where NULL doesn't join with NULL). > > However, with data.table, NA matches other NA. > > I.e, this should return an empty data.table > > data.table(idx = NA_real_, key = "idx")[data.table(idx = NA_real_, val = > "a", key = "idx"), nomatch = 0] > > Let's assume that we can't change this behavior, would it be possible to > add a parameter to avoid NA matching NA in [.data.table and merge? > _______________________________________________ > datatable-help mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > >
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
