[datatable-help] FR #748 discussion

Arunkumar Srinivasan aragorn168b at gmail.com
Sat Nov 9 12:32:59 CET 2013


Hey everybody, 

I've been wanting to implement this for a while. I dint know there was a FR lying around. All the more good!
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=748&group_id=240&atid=978

It's about filling unavailable values during "join" with values other than default NA.

Ex:

require(data.table)
DT <- data.table(x=c(1,2,3,6), y="A", key="x")
DT[J(1:6)] # at the moment, all "y" with no match to key entry will be NA_character_

The FR:

DT[J(1:6), fill = "bla"]

What I wanted to discuss about is the handling on "nomatch" parameter: At the moment we've a "nomatch" parameter that takes values NA or 0. NA being default and when it's 0, the no matches are *removed*. So how do we allow the "fill" argument?

I think "nomatch" should become logical with TRUE and FALSE mimicking the old functionality of filling with something or removing unavailable entries (that is, "nomatch=FALSE" = old "nomatch=0"). And if "nomatch=TRUE", then the value of "fill" (default = NA) will be used. For backwards compatibility, "nomatch" will be TRUE (keep no matches) and "fill=NA" (and assign them NA). Basically, "nomatch" has more priority than "fill". If "nomatch=FALSE", "fill" is ignored. 

Hm, do you find "nomatch=TRUE" as "keeping no matches" confusing? Maybe then we'll have to change this to "keep.nomatch".
I'm all ears for better ideas! So, please weigh in.

Arun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20131109/e919d778/attachment.html>


More information about the datatable-help mailing list