Prior to downloading data it is often valuable to have some estimate of how
many records are available, both for deciding if the query is feasible,
and for estimating how long it will take to download. Alternatively, for some kinds
of reporting, the count of observations may be all that is required, for example
for understanding how observations are growing or shrinking in particular
locations, or for particular taxa. To this end, atlas_counts()
takes
arguments in the same format as atlas_occurrences()
, and
provides either a total count of records matching the criteria, or a
data.frame
of counts matching the criteria supplied to the group_by
argument.
Arguments
- request
optional
data_request
object: generated by a call togalah_call()
.- identify
data.frame
: generated by a call togalah_identify()
.- filter
data.frame
: generated by a call togalah_filter()
- geolocate
string
: generated by a call togalah_geolocate()
- data_profile
string
: generated by a call togalah_apply_profile()
- group_by
data.frame
: An object of classgalah_group_by
, as returned bygalah_group_by()
. Alternatively a vector of field names (seesearch_all(fields)
andshow_all(fields)
.- limit
numeric
: maximum number of categories to return, defaulting to 100. If limit is NULL, all results are returned. For some categories this will take a while.- type
string
: one ofc("occurrences-count", "species-count")
. Defaults to"occurrences-count"
, which returns the number of records that match the selected criteria; alternatively returns the number of species. Formerly accepted arguments ("records"
or"species"
) are deprecated but remain functional.- x
An object of class
data_request
, created usinggalah_call()
- ...
currently ignored
- wt
currently ignored
- sort
currently ignored
- name
currently ignored
Value
An object of class tbl_df
and data.frame
(aka a tibble) returning:
A single number, if
group_by
is not specified or,A summary of counts grouped by field(s), if
group_by
is specified
Examples
if (FALSE) {
# classic syntax:
galah_call() |>
galah_filter(year == 2015) |>
atlas_counts()
# synonymous with:
request_data() |>
filter(year == 2015) |>
count() |>
collect()
}