Rekyt / taxo_harmonization

:notebook: Companion code for Grenié et al. 2022 MEE "Harmonizing taxon names in biodiversity data: a review of tools, databases, and best practices" preprint: 10.32942/osf.io/e3qnz

Home Page:https://doi.org/10.1111/2041-210X.13802

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

necessary to install R taxonomic packages for shinyapp?

emilio-berti opened this issue · comments

When I try to launch the shiny app I got the following error:

> source("server.R")
✔ Updated metadata database: 2.46 MB in 6 files.
✔ Updating metadata database ... done
Error: Cannot install packages:
* sckott/splister: Bad GitHub credentials, make sure that your GitHub token is valid.
* ropensci/taxizedb: Bad GitHub credentials, make sure that your GitHub token is valid.
* helixcn/plantlist: Bad GitHub credentials, make sure that your GitHub token is valid.
* traitecoevo/taxonlookup: Bad GitHub credentials, make sure that your GitHub token is valid.
* joelnitta/taxastand: Bad GitHub credentials, make sure that your GitHub token is valid.
* EDIorg/taxonomyCleanr: Bad GitHub credentials, make sure that your GitHub token is valid.
* idiv-biodiversity/lcvplants: Bad GitHub credentials, make sure that your GitHub token is valid.
* gustavobio/tpl: Bad GitHub credentials, make sure that your GitHub token is valid.
* sckott/taxspell: Bad GitHub credentials, make sure that your GitHub token is valid.
* gustavobio/tpldata: Bad GitHub credentials, make sure that your GitHu

I know how to fix this, I just wanted to know if it's necessary to install all these packages for the purpose of the shiny app.

Emilio

Just a suggestion here: dependency can be obtained from CRAN using python relatively easy. Save the following script as get-deps.py:

import sys
import pandas as pd

pkg_name = sys.argv[1]
print(pkg_name)
url = 'https://cran.r-project.org/web/packages/' + pkg_name + '/index.html'
print(url)
pkg = pd.read_html(url)[0]
imports = pkg[pkg[0] == 'Imports:'][1][2].replace(' ', '').split(',')
file = open(pkg_name + '.txt','w')
for x in imports:
    file.writelines(x)
    file.writelines('\n')

file.close()

This can be called with (e.g. with taxadb) python3 get-deps.py taxadb, which write the file taxadb.txt containing:

dplyr
DBI
arkdb(>0.0.10)
tibble
memoise
readr
rappdirs
rlang
magrittr
stringi
progress
utils
dbplyr
RSQLite
curl
jsonlite
duckdb
contentid

Depending on how we will store the app, but this is probably much lighter. Users need python, though.

The error is really weird, because the shiny app only loads the data from an RData file and doesn't actually perform the dependency search.

  1. Did you pull the last version of the repository before launching the shiny app?
  2. How do you launch the shiny app? Because source('server.R') doesn't launch it. You should run shiny::runApp("taxharmonizexplorer") and see.

Okay problem solved by pulling last version and running shiny::runApp("taxharmonizexplorer").
Also fixes #6