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.
atlas_counts(
request = NULL,
identify = NULL,
filter = NULL,
geolocate = NULL,
data_profile = NULL,
group_by = NULL,
limit = NULL,
type = c("record", "species"),
refresh_cache = FALSE
)# S3 method for data_request
count(x, ..., wt, sort, name, type = c("record", "species"))
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
optional data_request
object: generated by a call to
galah_call()
.
data.frame
: generated by a call to
galah_identify()
.
data.frame
: generated by a call to
galah_filter()
string
: generated by a call to
galah_geolocate()
string
: generated by a call to
galah_apply_profile()
data.frame
: An object of class galah_group_by
,
as returned by galah_group_by()
. Alternatively a vector of field
names (see search_all(fields)
and show_all(fields)
.
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.
string
: one of c("record", "species")
. Defaults to
"record". If "species", the number of species matching the criteria will be
returned, if "record", the number of records matching the criteria will be
returned.
logical
: if set to TRUE
and
galah_config(caching = TRUE)
then files cached from a previous query will
be replaced by the current query
An object of class data_request
, created using galah_call()
currently ignored
currently ignored
currently ignored
currently ignored
if (FALSE) {
# Count all records in the specified atlas
atlas_counts()
# Filtered counts
galah_call() |>
galah_filter(year == 2015) |>
atlas_counts()
}
Run the code above in your browser using DataLab