Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests failing for edge functions #23

Closed
robitalec opened this issue Feb 19, 2020 · 3 comments
Closed

tests failing for edge functions #23

robitalec opened this issue Feb 19, 2020 · 3 comments

Comments

@robitalec
Copy link
Member

robitalec commented Feb 19, 2020

Three warnings/errors for edge_dist and edge_nn:

longer object length is not a multiple of shorter object length

Different branches of j expression produced different auto-named columns: [NA!=distance]; using the most "last" names

When "returnDist" is TRUE, this error is added:
Internal error: jvnames is length 2 but ans is 4 and bynames is 1

@robitalec
Copy link
Member Author

This was solved by assigning, within the j {}, the output list.

Eg. for edge_nn, from:

    if (returnDist) {
      w <- wm + (length(wm) * (as.numeric(names(wm)) - 1))
      list(ID = .SD[[1]][as.numeric(names(wm))],
           NN = .SD[[1]][wm],
           distance = distMatrix[w])
    } else {
      list(ID = .SD[[1]][as.numeric(names(wm))],
           NN = .SD[[1]][wm])
    }

to:

    if (returnDist) {
      w <- wm + (length(wm) * (as.numeric(names(wm)) - 1))
      l <- list(ID = .SD[[1]][as.numeric(names(wm))],
                NN = .SD[[1]][wm],
                distance = distMatrix[w])
    } else {
      l <- list(ID = .SD[[1]][as.numeric(names(wm))],
                NN = .SD[[1]][wm])
    }
    l

The if/else block here depends on a variable ("returnDist") passed to the function, that is set outside of the data.table chunk and doesn't change within it.

@robitalec
Copy link
Member Author

Warnings+error present with data.table v.12.8 and not present with data.table v1.12.6.

Possibly related to Rdatatable/data.table#3802

@robitalec
Copy link
Member Author

Closed by #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant