Learn R Programming

galah (version 1.4.0)

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. The galah package enables users to construct their data queries using piping syntax (i.e., %>% from magrittr, or |> from base). Building a data query using piping allows users to use functions like search_taxa(), galah_filter(), [galah_select()], galah_group_by(), and galah_down_to() to specify filters for their queries line-by-line, narrowing the results of their query. Users then finish their query with an atlas_ function to identify which type of data they wish to download (i.e., atlas_occurrences(), atlas_counts(), atlas_species(), atlas_taxonomy() or atlas_media()).

Usage

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

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

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()

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

Examples

Using galah_call() with pipes allows you to build, filter and download data queries the same way that you would wrangle your own data with dplyr and the tidyverse. Begin your query with galah_call(), then use either %>% from magrittr or |> from base to narrow/filter your results line-by-line.

Find number of records of Aves from 2001 to 2004 by year

library(magrittr)

galah_call() %>% galah_identify("Aves") %>% galah_filter(year > 2000 & year < 2005) %>% galah_group_by() %>% atlas_counts()

Download Eolophus records from 2001 to 2004

galah_config(email = "your-email@email.com")

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

Find information for all species in Cacatuidae family

galah_call() %>%
  galah_identify("Cacatuidae") %>%
  atlas_species()