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

check that convert subset strata to dataframe if they are sf objects #89

Open
AdamCSmithCWS opened this issue Dec 19, 2024 · 0 comments
Assignees

Comments

@AdamCSmithCWS
Copy link
Contributor

If the user feeds a filtered version of the strata map to the stratify function: e.g.,

strata_alt <- load_map("bbs_cws") %>%
  filter(bcr != 3)

s <- stratify(by = "bbs_cws", strata_custom = strata_alt, species = "Canada Goose")

everything works fine until the generate indices function where it throws the following error:

Error in 'as_tibble()":
! All columns in a tibble must be vectors.
X Column 'geom' is a 'sfc_MultiPolygon/sfc' object.

This error relates to the meta_strata object which gets included as an sf object instead of the data frame the functions expect.

Insert a check into stratify_() to make sure any geometry is dropped when creating the metastrata object.

@AdamCSmithCWS AdamCSmithCWS self-assigned this Dec 19, 2024
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