Skip to content

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

@Aariq

Description

@Aariq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions