You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a small test script for the workflow, which can be used to test:
library(plantR) # used foi reading and cleaning occurrence dataoccs_gbif<- rgbif2(species="Rosaceae",
country="BR",
n.records=10)
occs<- formatDwc(gbif_data=occs_gbif, drop.empty=TRUE)
occsoccs<- formatOcc(occs)
occs<- formatLoc(occs)
occs<- formatCoord(occs)
occs<- formatTax(occs)
When using small sample datasets like this, it's not unusual that some essential fields will be empty. The problem is that the format functions do not detect this, and instead of failing gracefully they crash with uncaught errors. In this case, the errors are as follows:
> occs <- formatOcc(occs)
Error in `$<-.data.frame`(`*tmp*`, "recordNumber.new", value = character(0)) :
replacement has 0 rows, data has 10
> occs <- formatLoc(occs)
Error in `[.data.frame`(x, , match(loc.levels, colnames(x)), drop = FALSE) :
undefined columns selected
> occs <- formatCoord(occs)
Error in getCoord(x = coords1, lat.orig, lon.orig, lat.gazet, lon.gazet, :
One or more column names were not found: please check or specify column names
> occs <- formatTax(occs)
>
The text was updated successfully, but these errors were encountered:
Thanks for this issue. I have not used the package for running such small datasets. But you it should deal with smaller ones with missing fields. I added some patches along formatLoc() to make sure it does not fail any more. Not sure now if any other function may need the same patches. But at least I could not reproduce the error using your small test script after the changes I did in commit ac17995. Please let me know if you find any other issue related to this in other functions.
I created a small test script for the workflow, which can be used to test:
When using small sample datasets like this, it's not unusual that some essential fields will be empty. The problem is that the format functions do not detect this, and instead of failing gracefully they crash with uncaught errors. In this case, the errors are as follows:
The text was updated successfully, but these errors were encountered: