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

Better error message needed when points and grid do not overlap #39

Open
mpjashby opened this issue Jul 25, 2024 · 0 comments
Open

Better error message needed when points and grid do not overlap #39

mpjashby opened this issue Jul 25, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@mpjashby
Copy link
Owner

Describe the bug
When the grid does not overlap the points, a better error message is needed. Currently the message is Error in sum(counts$n): invalid 'type' (list) of argument.

To Reproduce

library(sf)
library(sfhotspot)
library(tidyverse)


# Loading Data ----------------------------------------------------

# ASB incidents in Lancashire in 2020 
asb <- read_tsv("https://mpjashby.github.io/crimemappingdata/lancashire_asb.tab") |>
	st_as_sf(coords = c("longitude","latitude"), crs = "EPSG:4326") |>
	st_transform("EPSG:27700")

# Lancashire districts
districts <- read_sf("https://mpjashby.github.io/crimemappingdata/northumbria_districts.geojson") |>
	st_transform("EPSG:27700")

# Calculate KDE values for Lancashire
asb_kde_Lancashire <- asb |>
	hotspot_kde(grid = hotspot_grid(districts, cell_size = 5000))

Expected behavior
An error message that explains the problem and how to fix it.

@mpjashby mpjashby added the bug Something isn't working label Jul 25, 2024
@mpjashby mpjashby self-assigned this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant