inbo / reporting-rshiny-grofwildjacht

Rshiny app for grofwildjacht
https://grofwildjacht.inbo.be/
MIT License
1 stars 1 forks source link

[BUG] Unrecognized faunabeheerzone gemeente in wildschade #478

Open mvarewyck opened 5 months ago

mvarewyck commented 5 months ago

Describe the bug In the wildschade data there are many (1029) records for which the fbz_gemeente is not available/unknown in the spatial data. This is because the assigned 'FaunabeheerZone' is wrong.

To Reproduce

> schadeData <- loadRawData(type = "wildschade")
> readS3(file = "spatialData_sf.RData")
> subSpatial <- spatialData$fbz_gemeentes
> 
> toCheck <- schadeData$fbz_gemeente[!schadeData$fbz_gemeente %in% subSpatial$NAAM]
> toCheck <- unique(toCheck[!is.na(toCheck)])
> length(toCheck)
[1] 1029
> head(sort(toCheck))
[1] "1_Aalter"    "1_Aarschot"  "1_Alken"     "1_Antwerpen" "1_As"       
[6] "1_Assenede" 

It's due to the assigned FaunabeheerZone

> schadeData[grep("Stekene", schadeData$fbz_gemeente), c("fbz_gemeente", "ID", "gemeente_afschot_locatie", "FaunabeheerZone")]
# A tibble: 12 × 4
   fbz_gemeente ID                        gemeente_afschot_loc…¹ FaunabeheerZone
   <chr>        <chr>                     <chr>                  <chr>          
 1 4_Stekene    856832-559                Stekene                4              
 2 4_Stekene    856832-560                Stekene                4              
 3 4_Stekene    695928-39                 Stekene                4              
 4 4_Stekene    853936-244                Stekene                4              
 5 4_Stekene    NP-202743482              Stekene                4              
 6 4_Stekene    NP-167845908              Stekene                4              
 7 4_Stekene    NP-186309836              Stekene                4              
 8 4_Stekene    NP-192102648              Stekene                4              
 9 9_Stekene    NP-212846457              Stekene                9              
10 6_Stekene    NP-212846458              Stekene                6              
11 5_Stekene    NP-255012457              Stekene                5              
12 4_Stekene    3af1373a-76c3-4557-b4ef-… Stekene                4              

Expected behavior We check whether all locations are available in the spatial data, so currently the R CMD check fails

Git SHA (after 0.3.1) a9d6da816bd8877bdcee556556b1d1d18199bdcc