Skip to content

problem joining with character(0) #847

Closed

Description

@tvr101

I recently upgraded to 1.9.2 and encountered the following issue. Previously this returned an empty data.table as I had expected (and desired), but now returns an error:

x <- data.table(a=character(0), b=character(0), c=numeric(0))
setkey(x, a, b)

x[J("foo", character(0)), nomatch=0]
Error in if (mn%%n[i] != 0) warning("Item ", i, " is of size ", n[i],  : 
  missing value where TRUE/FALSE needed

x[J(character(0), "foo"),nomatch=0]
Error in if (mn%%n[i] != 0) warning("Item ", i, " is of size ", n[i],  : 
  missing value where TRUE/FALSE needed

if there is only one key then this seems to behave as before

x <- data.table(a=character(0), b=character(0), c=numeric(0))
setkey(x, a)
x[J(character(0)),nomatch=0]
Empty data.table (0 rows) of 3 cols: a,b,c

is this expected with the new release? in my actual usage character(0) is a value held by another variable and that variable is used to search inside the data.table - is it user's responsibility to now check and avoid searching with empty character vectors?

Activity

  1. added this to the v1.9.6 milestone on Oct 2, 2014
  2. added a commit that references this issue on Oct 2, 2014
    59c77a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions