Learn R Programming

galah (version 1.5.4)

galah_call: Start building a data query

Description

To download data from the ALA (or another atlas), one must construct a data query. This query tells the atlas API what data to download and return, as well as how it should be filtered.

Usage

galah_call(
  identify = NULL,
  filter = NULL,
  select = NULL,
  geolocate = NULL,
  data_profile = NULL,
  group_by = NULL,
  down_to = NULL,
  ...
)

# S3 method for data_request print(x, ...)

Value

An object of class data_request.

Arguments

identify

data.frame: generated by a call to galah_identify()

filter

data.frame: generated by a call to select_filters()

select

data.frame: generated by a call to galah_select()

geolocate

string: generated by a call to galah_geolocate()

data_profile

string: generated by a call to galah_apply_profile()

group_by

data.frame: generated by a call to galah_group_by()

down_to

data.frame: generated by a call to galah_down_to()

...

other function-specific request parameters

x

an object of class data_request

Details

The galah package enables users to construct their data queries using piping syntax (i.e., %>% from magrittr, or |> from base).

Start a query with galah_call(). Pipe functions like galah_identify(), galah_filter(), [galah_select()], and galah_group_by() to narrow your query and specify filters. Finish a query with an atlas_ function to identify which type of data is downloaded (i.e., atlas_occurrences(), atlas_counts(), atlas_species(), atlas_taxonomy() or atlas_media()).

Using galah_call() with pipes allows you to build & filter a query to download data in the same way that you would wrangle data with dplyr and the tidyverse.

Examples

Run this code
if (FALSE) {
# Get number of records of *Aves* from 2001 to 2004 by year
galah_call() |>
  galah_identify("Aves") |>
  galah_filter(year > 2000 & year < 2005) |>
  galah_group_by(year) |>
  atlas_counts()
  
# Get information for all species in *Cacatuidae* family
galah_call() |>
  galah_identify("Cacatuidae") |>
  atlas_species()

# Download records of genus *Eolophus* from 2001 to 2004
galah_config(email = "your-email@email.com")

galah_call() |>
  galah_identify("Eolophus") |>
  galah_filter(year > 2000 & year < 2005) |>
  atlas_occurrences()
}

Run the code above in your browser using DataLab