diff --git a/DESCRIPTION b/DESCRIPTION index 7a97cac..43214ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,8 +37,7 @@ Imports: Suggests: testthat (>= 3.0.0), mapview, - dplyr, - tibble + dplyr Remotes: eblondel/ows4R RoxygenNote: 7.2.0 diff --git a/R/eurobis_occurrences.R b/R/eurobis_occurrences.R index 6aa859d..0f033d9 100644 --- a/R/eurobis_occurrences.R +++ b/R/eurobis_occurrences.R @@ -259,5 +259,7 @@ eurobis_sf_df_handler <- function(sf_df){ sf::st_crs(sf_df) <- 4326 + try({ attr(sf_df, "class") <- c("sf", "tbl_df", "tbl", "data.frame") }) + return(sf_df) } diff --git a/README.Rmd b/README.Rmd index 3d7dd1a..3a003b6 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,5 +1,6 @@ --- output: github_document +df_print: "tibble" --- @@ -54,8 +55,7 @@ A basic example is: library(eurobis) # Get one single dataset -dataset <- eurobis_occurrences_basic(dasid = 8045) -dplyr::glimpse(dataset) +eurobis_occurrences_basic(dasid = 8045) ``` For detailed information run: @@ -67,16 +67,15 @@ help(eurobis_occurrences) ## Query by traits Use the `functional_group` argument: -```{r func_groups} +```{r func_groups, eval = FALSE} # Get one single dataset -dataset <- eurobis_occurrences_basic(dasid = 8045, functional_groups = "angiosperms") -dplyr::glimpse(dataset) +eurobis_occurrences_basic(dasid = 8045, functional_groups = "angiosperms") ``` See the full list of queriable traits in the exported dataset `species_traits`: ```{r traits} -tibble::as_tibble(species_traits) +species_traits ``` diff --git a/README.md b/README.md index 8c55bbe..9047d30 100644 --- a/README.md +++ b/README.md @@ -15,24 +15,24 @@ The `eurobis` R package allows you to download data from EurOBIS. You can query on: -- **Dataset**: provide the Integrated Marine Information System + - **Dataset**: provide the Integrated Marine Information System ([IMIS](https://www.vliz.be/en/integrated-marine-information-system)) unique identifier for datasets [DasID](https://www.vliz.be/imis?page=webservices). -- **Taxon**: use a scientific name (e.g. the sea turtle *Caretta + - **Taxon**: use a scientific name (e.g. the sea turtle *Caretta caretta*) or a [WoRMS AphiaID](https://www.marinespecies.org/about.php#what_is_aphia) (e.g. [137205](https://www.marinespecies.org/aphia.php?p=taxdetails&id=137205)) -- **Traits**: get all occurrences that are benthos. Or zooplankton. Or + - **Traits**: get all occurrences that are benthos. Or zooplankton. Or both. Powered by [WoRMS](https://www.marinespecies.org/). -- **Time**: just give start and end dates. -- **Geographically**: it allows to query on more than 300 records from + - **Time**: just give start and end dates. + - **Geographically**: it allows to query on more than 300 records from the [Marine Regions Gazetteer](https://marineregions.org/gazetteer.php) by giving the [MRGID](https://marineregions.org/mrgid.php). Or just pass the area of your interest as a polygon written in as [Well Known Text](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) -- Other important classifications as [IUCN Red + - Other important classifications as [IUCN Red List](https://www.iucnredlist.org/en), [MSDF Indicators](https://msfd.eu/knowseas/guidelines/3-INDICATORS-Guideline.pdf) or [Habitats @@ -61,25 +61,35 @@ A basic example is: library(eurobis) # Get one single dataset -dataset <- eurobis_occurrences_basic(dasid = 8045) +eurobis_occurrences_basic(dasid = 8045) #> Loading ISO 19139 XML schemas... #> Loading ISO 19115 codelists... +#> Loading IANA mime types... +#> No encoding supplied: defaulting to UTF-8. #> ✔ Downloading layer: EMODnet EurOBIS Basic Occurrence Data #> ℹ The Basic Occurrence Data download provides you data for the following 8 essential terms: datasetid, datecollected, decimallongitude, decimallatitude, coordinateuncertaintyinmeters, scientificname, aphiaid, scientificnameaccepted. For more information, please consult: https://www.emodnet-biology.eu/emodnet-data-format. -dplyr::glimpse(dataset) -#> Rows: 52 -#> Columns: 11 -#> $ gml_id "eurobis-obisenv_basic.fid-632d47d4_1860… -#> $ id 28840495, 28841810, 28837086, 28866685, … -#> $ datasetid "http://www.emodnet-biology.eu/data-cata… -#> $ datecollected 2020-03-03 01:00:00, 2020-05-05 02:00:0… -#> $ decimallongitude -8.73914, -8.73948, -8.73902, -8.73948, … -#> $ decimallatitude 40.61804, 40.61899, 40.61773, 40.61899, … -#> $ coordinateuncertaintyinmeters 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5… -#> $ scientificname "Zostera marina", "Zostera marina", "Zos… -#> $ aphiaid "http://marinespecies.org/aphia.php?p=ta… -#> $ scientificnameaccepted "Zostera subg. Zostera marina", "Zostera… -#> $ geometry POINT (-8.73914 40.61804), POINT (… +#> Simple feature collection with 52 features and 10 fields +#> Geometry type: POINT +#> Dimension: XY +#> Bounding box: xmin: -8.73964 ymin: 40.61773 xmax: -8.73902 ymax: 40.61899 +#> CRS: EPSG:4326 +#> # A tibble: 52 × 11 +#> gml_id id datas…¹ datecollected decim…² decim…³ coord…⁴ scien…⁵ +#> * +#> 1 eurobis-o… 3.68e7 https:… 2020-05-05 00:00:00 -8.74 40.6 5 Zoster… +#> 2 eurobis-o… 3.68e7 https:… 2019-12-13 00:00:00 -8.74 40.6 5 Zoster… +#> 3 eurobis-o… 3.68e7 https:… 2020-03-03 00:00:00 -8.74 40.6 5 Zoster… +#> 4 eurobis-o… 3.68e7 https:… 2019-12-13 00:00:00 -8.74 40.6 5 Zoster… +#> 5 eurobis-o… 3.68e7 https:… 2020-08-10 00:00:00 -8.74 40.6 5 Zoster… +#> 6 eurobis-o… 3.68e7 https:… 2020-08-10 00:00:00 -8.74 40.6 5 Zoster… +#> 7 eurobis-o… 3.68e7 https:… 2020-05-05 00:00:00 -8.74 40.6 5 Zoster… +#> 8 eurobis-o… 3.68e7 https:… 2020-05-05 00:00:00 -8.74 40.6 5 Zoster… +#> 9 eurobis-o… 3.68e7 https:… 2020-03-03 00:00:00 -8.74 40.6 5 Zoster… +#> 10 eurobis-o… 3.68e7 https:… 2020-05-05 00:00:00 -8.74 40.6 5 Zoster… +#> # … with 42 more rows, 3 more variables: aphiaid , +#> # scientificnameaccepted , geometry , and abbreviated +#> # variable names ¹​datasetid, ²​decimallongitude, ³​decimallatitude, +#> # ⁴​coordinateuncertaintyinmeters, ⁵​scientificname ``` For detailed information run: @@ -94,46 +104,113 @@ Use the `functional_group` argument: ``` r # Get one single dataset -dataset <- eurobis_occurrences_basic(dasid = 8045, functional_groups = "angiosperms") -#> ✔ Downloading layer: EMODnet EurOBIS Basic Occurrence Data -#> ℹ The Basic Occurrence Data download provides you data for the following 8 essential terms: datasetid, datecollected, decimallongitude, decimallatitude, coordinateuncertaintyinmeters, scientificname, aphiaid, scientificnameaccepted. For more information, please consult: https://www.emodnet-biology.eu/emodnet-data-format. -#> Warning in eurobis_occurrences(type = "basic", ...): There are 0 occurrences in -#> EurOBIS for this query at the moment -dplyr::glimpse(dataset) -#> Rows: 0 -#> Columns: 11 -#> $ gml_id -#> $ id -#> $ datasetid -#> $ datecollected -#> $ decimallongitude -#> $ decimallatitude -#> $ coordinateuncertaintyinmeters -#> $ scientificname -#> $ aphiaid -#> $ scientificnameaccepted -#> $ geometry +eurobis_occurrences_basic(dasid = 8045, functional_groups = "angiosperms") ``` See the full list of queriable traits in the exported dataset `species_traits`: ``` r -tibble::as_tibble(species_traits) -#> # A tibble: 32 × 4 -#> category group selection selectid -#> -#> 1 Species group Functional group algae Algae -#> 2 Species group Functional group angiosperms Angiosperms -#> 3 Species group Functional group benthos Benthos -#> 4 Species group Functional group birds Birds -#> 5 Species group Functional group mammals Mammals -#> 6 Species group Functional group phytoplankton phytoplankton -#> 7 Species group Functional group pisces pisces -#> 8 Species group Functional group reptiles Reptiles -#> 9 Species group Functional group zooplankton zooplankton -#> 10 Species importance to society CITES Annex I 28_280_0 -#> # … with 22 more rows +species_traits +#> category group +#> 1 Species group Functional group +#> 2 Species group Functional group +#> 3 Species group Functional group +#> 4 Species group Functional group +#> 5 Species group Functional group +#> 6 Species group Functional group +#> 7 Species group Functional group +#> 8 Species group Functional group +#> 9 Species group Functional group +#> 10 Species importance to society CITES Annex +#> 11 Species importance to society CITES Annex +#> 12 Species importance to society CITES Annex +#> 13 Species importance to society Habitats Directive Annex +#> 14 Species importance to society Habitats Directive Annex +#> 15 Species importance to society IUCN Red List Category +#> 16 Species importance to society IUCN Red List Category +#> 17 Species importance to society IUCN Red List Category +#> 18 Species importance to society MSFD indicators +#> 19 Species importance to society MSFD indicators +#> 20 Species importance to society MSFD indicators +#> 21 Species importance to society MSFD indicators +#> 22 Species importance to society MSFD indicators +#> 23 Species importance to society MSFD indicators +#> 24 Species importance to society MSFD indicators +#> 25 Species importance to society MSFD indicators +#> 26 Species importance to society MSFD indicators +#> 27 Species importance to society MSFD indicators +#> 28 Species importance to society MSFD indicators +#> 29 Species importance to society MSFD indicators +#> 30 Species importance to society MSFD indicators +#> 31 Species importance to society MSFD indicators +#> 32 Species importance to society MSFD indicators +#> selection +#> 1 algae +#> 2 angiosperms +#> 3 benthos +#> 4 birds +#> 5 mammals +#> 6 phytoplankton +#> 7 pisces +#> 8 reptiles +#> 9 zooplankton +#> 10 I +#> 11 II +#> 12 III +#> 13 II +#> 14 IV +#> 15 data deficient +#> 16 least concern +#> 17 near threatened +#> 18 Black Sea proposed indicators +#> 19 HELCOM core biodiversity indicators +#> 20 Mediterranean proposed indicators - Adriatic Sea +#> 21 Mediterranean proposed indicators - Aegean-Levantine Sea +#> 22 Mediterranean proposed indicators - Ionian Sea +#> 23 Mediterranean proposed indicators - Mediterranean Sea +#> 24 Mediterranean proposed indicators - Western Mediterranean +#> 25 OSPAR candidate indicators: Bay of Biscay and the Iberian Coast +#> 26 OSPAR candidate indicators: Celtic Seas +#> 27 OSPAR candidate indicators: Greater North Sea including outside EU +#> 28 OSPAR candidate indicators: North Sea +#> 29 OSPAR common indicators: Bay of Biscay and Iberian Coast +#> 30 OSPAR common indicators: Celtic Seas +#> 31 OSPAR common indicators: Greater North Sea +#> 32 OSPAR common indicators: Greater North Sea including outside EU +#> selectid +#> 1 Algae +#> 2 Angiosperms +#> 3 Benthos +#> 4 Birds +#> 5 Mammals +#> 6 phytoplankton +#> 7 pisces +#> 8 Reptiles +#> 9 zooplankton +#> 10 28_280_0 +#> 11 28_281_0 +#> 12 28_282_0 +#> 13 26_269_0 +#> 14 26_271_0 +#> 15 1_8_3 +#> 16 1_7_3 +#> 17 1_6_3 +#> 18 23_285_41 +#> 19 23_285_29 +#> 20 23_285_31 +#> 21 23_285_32 +#> 22 23_285_33 +#> 23 23_285_34 +#> 24 23_285_30 +#> 25 23_285_35 +#> 26 23_285_36 +#> 27 23_285_37 +#> 28 23_285_38 +#> 29 23_285_44 +#> 30 23_285_45 +#> 31 23_285_46 +#> 32 23_285_40 ``` ## Query by location @@ -206,21 +283,21 @@ www.emodnet-biology.eu/toolbox, consulted on yyyy-mm-dd. Regarding the citation of the individual datasets, the following guidelines should be taken into account: -- If any individual data source of EurOBIS constitutes a significant + - If any individual data source of EurOBIS constitutes a significant proportion of the downloaded and used records (e.g. more than 10% of the data is derived from a single source), the individual data source should also be cited. -- If any individual data source of EurOBIS constitutes a substantial + - If any individual data source of EurOBIS constitutes a substantial proportion of the downloaded and used records (e.g. more than 25% of the data is derived from a single source or the data is essential to arrive at the conclusion of the analysis), the manager or custodian of this data set should be contacted. -- In any case, it may be useful to contact the data custodian + - In any case, it may be useful to contact the data custodian directly. The data custodian might have additional data available that may strengthen the analysis or he/she might be able to provide additional helpful information that may not be apparent from the provided metadata. -- The data may not be redistributed without the permission of the + - The data may not be redistributed without the permission of the appropriate data owners. If data are extracted from the EMODnet Data Portal for redistribution, please contact us at . diff --git a/man/eurobis_list_datasets.Rd b/man/eurobis_list_datasets.Rd index 3f85066..8e6a66a 100644 --- a/man/eurobis_list_datasets.Rd +++ b/man/eurobis_list_datasets.Rd @@ -28,5 +28,5 @@ You can read this easily in R, e.g: jsonlite::fromJSON("https://www.vliz.be/en/imis?module=dataset&dasid=216&show=json") } \examples{ -\dontrun{eurobis_list_datasets()} +\dontrun{eurobis_list_datasets()}devtool } diff --git a/man/eurobis_list_regions.Rd b/man/eurobis_list_regions.Rd index 3f49cc2..babafd0 100644 --- a/man/eurobis_list_regions.Rd +++ b/man/eurobis_list_regions.Rd @@ -21,11 +21,12 @@ See https://marineregions.org/mrgid.php for further information. You can find more info about each marine region by searching in the Marine Regions website: https://marineregions.org/gazetteer.php?p=search -Or you can use the mregion2 R package (on development): +Or you can use the mregion2 R package: https://github.com/lifewatch/mregions2 E.g.: -mregions2::mr_gaz_record(25600) +library(mregions2) +gaz_search(25600) } \examples{ \dontrun{eurobis_list_regions()}