TIBHannover / BacDiveR

Inofficial R client for the DSMZ's Bacterial Diversity Metadatabase (former contact: @katrinleinweber). https://api.bacdive.dsmz.de/client_examples seems to be the official alternatives.
https://TIBHannover.GitHub.io/BacDiveR/
MIT License
10 stars 12 forks source link

bd_retrieve_by_search output #112

Open leandronascimentolemos opened 4 years ago

leandronascimentolemos commented 4 years ago

I have a question:

Is there any function to export the bd_retrieve_by_search output file in csv?

Thanks.

katrinleinweber commented 4 years ago

Hello Leandro & thanks for your interest in BacDiveR :-)

There is no such function built-in, sorry. Because the list-structure of datasets depends on which data they actually contain, I wasn't sure how best to approach a bacdive_to_csv function that would work in all cases. The BacDive team didn't include it in their examples, either.

Maybe tidyr and/or tibble contain a function for that? Or something from StackOverflow?

What should be possible in any case, however, is to extract the fields you are interested in into a new dataframe.

In both cases, afterwards, your use readr::write_..., or other R-native export functions.

I hope these pointers prove useful to you. Please do post the solution here, or feel free to send a PR to extend one the vignettes (.Rmd files).

Kind regards, and good luck!

Katrin

katrinleinweber commented 4 years ago

I experimented a bit in dd126c4274dc397e1b9e49533fd4baa397591c1f, but I'm always running into:

Error: No common type for taxonomy_name$data$data and references$data$data <data.frame< ID_reference: integer reference : character >>.

:-/