sampbias
sampbias copied to clipboard
cannot make custom gazetteers
Hi there, I am trying to use this package to examine whether the reported abundance of a species at a particular location depends on the distance of that location from the closest sampling station. Thus, I need to create a custome gazetteer that contains all the sampling stations. I cannot find instructions or examples on how to make a custom gazetteer. Please help me create a custom gazetteer. Thanks.
I tried using the following code to create a raster, gaz_sta, and then running calculcate_bias() with gaz = out, but it didn't work. I also tried running calculate bias() with gaz = gaz_sta, and that also didn't work.
stations <- read_csv([insert attached file]) %>% dplyr::select(Sta_ID, DLat_Dec, DLon_Dec) %>% mutate(latitude = DLat_Dec, longitude = DLon_Dec) %>% dplyr::select(-DLat_Dec, -DLon_Dec)
sp_stations <- SpatialPointsDataFrame(coords = stations[,3:2], data = data.frame(stations[,1]))
lin <- data.frame(long = seq(min(stations$longitude), max(stations$longitude), by = 1), lat = seq(min(stations$latitude), max(stations$latitude), by = min(stations$latitude) - max(stations$latitude) / 24))
lin <- sp::SpatialLinesDataFrame(sl = sp::SpatialLines(list(sp::Lines(sp::Line(lin), ID="B1"))), data = data.frame("B", row.names = "B1"))
gaz_sta <- list(point.structure = sp_stations, lines.structure = lin)
ras <- raster::raster(raster::extent(min(stations$longitude),max(stations$longitude),min(stations$latitude),max(stations$latitude)), res = min(stations$latitude) - max(stations$latitude) / 24)
out <- dis_rast(gaz_sta, ras)
this doesn't work: example.out <- calculate_bias(x = test_s2, gaz = out, res = 0.1)
this doesn't work, either: example.out <- calculate_bias(x = test_s2, gaz = gaz_sta, res = 0.1)
Hi, thanks for the report. I am out of office until Feb '22. I will try to look at this as soon as possible!
Hello there! We've recently overhauled the Sampbias package, integrating new spatial packages and implementing substantial changes to the code. If you're still encountering the issue after updating the package to the latest version available on GitHub, could you please share a reproducible code along with the accompanying data? This will enable us to investigate the error more effectively and provide you with a timely resolution. Your cooperation is greatly appreciated!