Giter Site home page Giter Site logo

luomus / finbif Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 73.44 MB

R interface for the Finnish Biodiversity Information Facility (FinBIF) API

Home Page: https://luomus.github.io/finbif/

License: Other

R 98.19% Makefile 1.48% CSS 0.18% HTML 0.14%
api biodiversity biodiversity-informatics biodiversity-information finbif finbif-access occurrences r-package r-programming rstats

finbif's Introduction

FinBIF R package

Project Status: Active – The project has reached a stable, usable state and is being actively developed. License CRAN status r-universe CRAN downloads DOI Build Status codecov

The finbif R package is a programmatic interface to the Finnish Biodiversity Information Facility (FinBIF) API. FinBIF aggregates Finnish biodiversity data from multiple sources in a single open access portal for researchers, citizen scientists, industry and government. FinBIF allows users of biodiversity information to find, access, combine and visualise data on Finnish plants, animals and microorganisms. The finbif R package makes the publicly available data in FinBIF easily accessible to programmers. Biodiversity information is available on taxonomy and taxon occurrence. Occurrence data can be filtered by taxon, time, location and other variables. The data accessed are conveniently preformatted for subsequent analyses.

Installation

You can install the current stable version of finbif from CRAN,

install.packages("finbif")

You can also install the latest development version of finbif from GitHub,

remotes::install_github("luomus/finbif@dev")

Documentation

Read the online documentation for the current stable version of finbif here, or the latest development version of finbif here.

Getting a FinBIF access token

First load the finbif R package.

library(finbif)

To use the FinBIF API you must first request and set a personal access token. You can request an API token to be sent to your email address with the function finbif_get_token.

finbif_request_token("[email protected]")

Copy the access token that was sent to your email and set it as the environment variable FINBIF_ACCESS_TOKEN either for the current session,

Sys.setenv(
  FINBIF_ACCESS_TOKEN = "xtmSOIxjPwq0pOMB1WvcZgFLU9QBklauOlonWl8K5oaLIx8RniJLrvcJU4v9H7Et"
)
# Note: the above is not a real access token. Do not try using it.

, or by adding it to a Renviron startup file (see here for details).

Usage

Download occurrence data from FinBIF.

finbif_occurrence("Cygnus cygnus", n = 100)

Citation

Data from FinBIF comes from many sources. For information on citing FinBIF itself and the contributed datasets please visit this link:

https://laji.fi/en/about/2986

To cite the finbif R package in publications please use:

Morris, William K. (2024). Introduction to the finbif package. R package version 0.9.8, https://doi.org/10.5281/zenodo.3612814


Contributing

Development is a community effort, and we encourage participation. Please read the contribution guide for details.

Please note that the 'finbif' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

finbif's People

Contributors

wkmor1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jlehtoma

finbif's Issues

WISH: Run checks with a random port rather than a fixed (port 36761)

Hello. This is not an end-user feature request, but rather a wish from someone who tests finbif as a reverse dependency package.

When I'm running revdep checks on future (using the revdepcheck package), each package tested is processed with the CRAN version of future and the development version of future. These two checks are run at the same time.

Now, since one of the finbif package tests opens a server on port 36761;

api <- local_app_process(app, .local_envir = teardown_env(), port = 36761)

the above two checks will compete for this port, and one will fail, e.g.

══ Failed tests ════════════════════════════════════════════════════════════════
  70   │   ── Error ('test-local-finbif_occurrence_load.R:26'): (code run outside of `test_that()`) ──
  71   │   <callr_status_error/callr_error/rlib_error_3_0/rlib_error/error/condition>
  72   │   Error: ! failed to start webfakes app process: in callr subprocess.
  73   │   Caused by error: 
  74   │   ! Cannot start webfakes web server @rweb.c:479 (server_start)
  75   │   Error log:
  76   │   [1670565560] [error] [client ] cannot bind to 127.0.0.1:36761: 98 (Address already in use)
  77   │   [1670565560] [error] [client ] Failed to setup server ports
  78   │   
  79   │   Backtrace:
  80   │       ▆
  81   │    1. ├─base::options(finbif_dl_url = api[["url"]]()) at test-local-finbif_occurrence_load.R:26:2
  82   │    2. └─api[["url"]]()
  83   │    3.   └─self$start()

Ask

Is it important that it's port 36761 here? If not, would you consider using a random port instead, e.g.

port <- sample(1024:65535, size = 1L)
api <- local_app_process(app, .local_envir = teardown_env(), port = port)

Would that work for you? That would lower the risk of port clashes.

BTW, if you're willing to introduce more dependencies, one can even make sure that the random port is free by using either:

port <- parallelly::freePort()

or

port <- port4me::port4me()

Remove usethis from Suggests?

I will soon submit usethis v2.0.0 to CRAN.

I see that usethis is in Suggests for finbif, but I don't think the package itself actually uses usethis. I see that it's used below data-raw/, but that's a development dependency. I'm wondering if you might want to remove usethis from Suggests?

Selflishly, this means finbif is no longer a revdep that I need to check or that CRAN checks whenever usethis updates.

In any case, at the moment, finbif is one of the revdep failures I see, yet I don't think this has anything to do with usethis. I'm not sure what the problem is and it's seen when checking finbif against both the CRAN and dev versions of usethis.

Here's what I'm seeing if you want to take a look:

https://github.com/r-lib/usethis/blob/9bcf5b1cedb23a3f7806f6446597c2af46fc1c25/revdep/failures.md#finbif

Presumably there is some set of conditions, fulfilled by our cloud revdep check system, for which calling get_locale() in .onLoad() does not work (?). I realize this may be of no practical relevance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.