Comments (2)
Maybe this could be interesting as well https://github.com/iobis/obistools/blob/master/R/match_taxa.R . It also accounts for non exact matches
from movepub.
Approach 1
Extract unique taxa (vector) from reference data, run it through worrms and convert back to a dataframe, which can then be loaded as sqlite table and LEFT JOIN
ed
taxa_vector <- dplyr::distinct(ref, `animal-taxon`) %>% dplyr::pull()
taxa <-
taxa_vector %>%
worrms::wm_name2id_() %>%
dplyr::as_tibble() %>%
tidyr::pivot_longer(cols = dplyr::everything()) %>%
dplyr::rename(scientific_name = name, aphia_id = value)
Approach 2
Run a rowwise mutate directly on the reference data:
ref %>% rowwise() %>% mutate(aphia_id = worrms::wm_name2id(`animal-taxon`))
This is slower, since it the function is called for every record (typically less than 100). But avoids the tidyr dependency and loading in database. It will also return an error on no match.
from movepub.
Related Issues (20)
- Update message when loading HOT 2
- Write orcids as https HOT 2
- Movebank study ids are not 32 bit integers HOT 1
- Map `deploy-on-measurements` and other new fields to Darwin Core
- Write tests for `write_dwc()` HOT 3
- Terms like `deploy-on measurements` written with hyphen in NERC HOT 8
- Unrecognized character in definition for `GSM signal strength` HOT 2
- Fix links in vignettes/movepub.Rmd
- Add tests for `get_aphia_id()`
- Provide copy of `read_package()` and `write_package()` from frictionless
- Split `write_dwc()` into `write_dwc()` and `write_eml()` HOT 2
- Make clickable aphia_id in message
- Fix bug with updated glue HOT 2
- Deprecate `get_mvb_term()`
- Use dplyr for write_dwc()
- `o_assen` does not pass the frictionless checks anymore HOT 1
- html code is lost during conversion to eml HOT 3
- Create helper functions for `write_dwc()`
- Fix build failure HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from movepub.