Skip to contents

# Fetch zonal statistics

Source: `R/fetch_data.R`
`fetch_data.Rd`

Fetch zonal statistics from a product for given municipality code and dates.

## Usage

    fetch_data(code_muni, product, indicator, statistics, date_start, date_end)

## Arguments

code_muni

  numeric. IBGE municipality code number with 7 digits.

product

  string. Zonal indicator product. Options are: `brdwgd`, `terraclimate`.

indicator

  string. Indicator name from the product. Check the available indicators with the product_info function.

statistics

  string. Statistics name from the indicator. Check the available statistics with the product_info function.

date_start

  date, included in the selection.

date_end

  date, included in the selection, must be equal or greater than `date_start`.

## Value

A `tibble` with date and value columns.

## Details

For products with monthly data, like `terraclimate`, inform the start and end dates with the fist day of the month. Example: `as.Date("2008-06-01")` for June, 2008.

## Examples

    if (FALSE) {
    fetch_data(
        code_muni = 3304557,
        product = "brdwgd",
        indicator = "tmax",
        statistics = "mean",
        date_start = as.Date("2008-01-01"),
        date_end = as.Date("2008-01-10")
     )
     }