iobis / robis

R client for the OBIS API
https://iobis.github.io/robis
Other
37 stars 11 forks source link

exclude= in occurrence() #63

Closed lizmiller2633 closed 2 years ago

lizmiller2633 commented 4 years ago

Hello,

I'm not sure that the exclude option in the occurrence function is working as intended. In the past, I've successfully used an earlier version of the function to do outlier analysis (version 0.1.2). I was following Vandepitte et al. 2015. Now I want to download a lot of data (for 30,000+ species) and do outlier analysis on each species. I see that qc= was replaced with exclude= and it seems to serve the same purpose. However no data points seem to be excluded. I've tried several taxa and checking against OBIS website. The function seems to be downloading all occurrences.

For example, I did: x <- occurrence("Acanthurus achilles", fields= c("scientificName", "maximumDepthInMeters", "lifeStage", "depth"), exclude = c(2,3,4,5,6,9,18,19,1,10,22)) #notice code 22 was added here

and then: y <- occurrence("Acanthurus achilles", fields= c("scientificName", "maximumDepthInMeters", "lifeStage", "depth")) #notice code 22 was added here

The same number of occurrences were downloaded and the datasets seem identical.

Thank you!

pieterprovoost commented 4 years ago

@lizmiller2633 We are currently reimplementing the QC flags and do no longer support all Vandepitte et al. 2015 flags. We currently have a very limited set of flags, see https://github.com/iobis/obis-qc for the checks we currently do, the flags, and how these relate to Vandepitte et al. 2015. We are not doing any outlier analysis ourselves for now, but there are some functions for that in the https://github.com/iobis/obistools#check-outliers package. Please reach out to me at p.provoost@unesco.org if you need any help filtering the data.

goldsoundz80 commented 2 years ago

I am trying to use QC flags and am experiencing the same issue. Exclude seems to exclude nothing (I have individually tried each flag and get the same number of results each time), and using something like qc = 1:3 gives me an error saying it can't connect to the Obis API. The link you gave ^^ about available flags is now broken.

Code I have tried: I've individually specified every available flag with the same results for each: epibiota_depth_with_QC <- occurrence(scientificname = "Xylophaga dorsalis", exclude = 25)

Seems to have no effect at all (with any flag) epibiota_depth_with_QC <- occurrence(scientificname = "Xylophaga dorsalis", qc = 1)

Example from the documentation returns an error: records <- occurence(scientificname = "Abra sibogai", qc = c(1:6, 27)) Error: Failed to connect to the OBIS API. If the problem persists, please contact helpdesk@obis.org

pieterprovoost commented 2 years ago

Thanks for reporting, but I think you are looking at very outdated documentation. Parameters for filtering on QC flags are called exclude and flags, see the function reference at https://iobis.github.io/robis/reference/index.html. For example:

occurrence("Abra", exclude = c("NO_DEPTH", "ON_LAND"))
occurrence("Abra", flags = c("NO_DEPTH", "ON_LAND"))

I fixed the link above.

goldsoundz80 commented 2 years ago

Ah yes, it does appear to be quite old, apologies. Thank you for updating the link to the possible flags, that's solved my problem!