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

partition_disc() errors unexpectedly and uninformatively if data is a tibble #74

Open
Aariq opened this issue Jun 11, 2024 · 0 comments

Comments

@Aariq
Copy link

Aariq commented Jun 11, 2024

If the data argument is a tibble, I get the error

Error in Ops.data.frame(data[, coords[1]], data[i, coords[1]]) : 
  ‘-’ only defined for equally-sized data frames

The error occurs here:

https://github.com/giscience-fsu/sperrorest/blob/b4d2a1426bfcbb2f5630c6182ff946b926f96e4a/R/sperrorest_resampling.R#L786C21-L786C38

The code on these lines relies on data[, "x"] returning a numeric vector, but for tibble data frames, a data.frame is returned. This could instead be written in a way that doesn't assume coercion to a vector like so:

di <- sqrt((data[[coords[1]]] - data[[coords[1]]][i])^2 + # nolint
             (data[[coords[2]]] - data[[coords[2]]][i])^2) # nolint

Which should work for both

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

No branches or pull requests

1 participant