inbo / etn

R package to access data from the European Tracking Network
https://inbo.github.io/etn/
MIT License
6 stars 5 forks source link

Unable to retrieve animals of certain species, but able to retrieve detections #286

Closed lottepohl closed 11 months ago

lottepohl commented 1 year ago

Hi all!

I would like to retrieve information on tagged spiny dogfish (Squalus acanthias). For some reason I get an empty dataframe when wanting to retrieve information on the animals with etn::get_animals(), but I can retrieve all detections for Squalus acanthias individuals with etn::get_acoustic_detections().

Any idea what I might be doing wrong? etn::get_animals() works perfectly fine with other strings for scientific_name such as "Gadus morhua" or "Mustelus asterias"...

Thanks a lot in advance!! Cheers, Lotte

here is a MWE:

library(etn)
con <- etn::connect_to_etn(Sys.getenv("userid"), Sys.getenv("pwd"))

species_name <- "Squalus acanthias"

animals <- etn::get_animals(con, scientific_name = species_name)
# check contents
nrow(animals)
#> [1] 0

detections <- etn::get_acoustic_detections(scientific_name = species_name)
# check contents
nrow(detections)
#> [1] 1279042

# amount of S. acanthias individuals detected
detections$animal_id %>% unique() %>% length()
#> Error in detections$animal_id %>% unique() %>% length(): could not find function "%>%"
lottepohl commented 1 year ago

I could download the animal data on the ETN data portal and I see that the column names are very outdated, might be the reason why etn::get_animals() does not find anything.... Take a look: Squalus_acanthias_animals.csv.

I now load the .csv that I downloaded from the data portal but maybe outdated column names are also present for other species/individuals that were tagged a couple of years ago? If so, this might be a topic worth investigating, would be a shame if all these animals and detections could not be accessed via the etn R package.

Cheers! Lotte

CLAUMEMO commented 1 year ago

When downloading data from the ETN platform tables the column names match those of the ETN database table, not the ones of the dataframes fromo the ETN R package. They are not outdated, they sjut are named differently. But is it true that they should maybe be the same.

For the etn::get_animals() giving you an empty dataframe, I believe this is because the animals are not linked to an animal project. I'll have to check with the tag owner.

PietrH commented 12 months ago

@CLAUMEMO Did you have a chance to look into this?

CLAUMEMO commented 11 months ago

Yes. You can close the issue :)

PietrH commented 11 months ago

Great! Just open a new issue if you want to start any discussion on renaming column names or any other issue.