Asks the API for the number of rows matching a set of filters without
retrieving them. Worth doing before a large tg_get(): the biggest table in
these APIs holds over a million rows, which at 200 rows a request is more
than five thousand requests.
Usage
tg_count(module, table, ..., .cache = NULL, .base_url = NULL)
tg_contar(module, table, ..., .cache = NULL, .base_url = NULL)Arguments
- module
A module name from
tg_modules():"especiais","fundoafundo"or"parcerias". Aliases such as"fundo_a_fundo"are accepted.- table
A table name from
tg_tables().- ...
Filters, named after the parameters they set. See
tg_get().- .cache
Whether to serve the request from the response cache.
NULLfollows thetransferegovr.cacheoption. Seetg_cache_dir().- .base_url
The API base URL. Defaults to
tg_base_url().
See also
Other queries:
module_shortcuts,
tg_get(),
tg_metadata()
Examples
if (interactive()) {
tg_count("parcerias", "proposta")
tg_count("parcerias", "proposta", situacao_proposta = "Aprovada")
}