---
title: "CENSOAGRO"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{CENSOAGRO}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```


The census of agriculture collects information about agricultural establishments
and the agricultural activities carried out there, covering characteristics of the
producer and establishment, economy and employment in rural areas, livestock, 
farming and agroindustry. 

Data is collected by IBGE and is available at
country, state and municipality level.

***
**Options:**

  1.  **dataset**:there are 10 possible choices:
      * `"agricultural_land_area"`: area and number of agricultural properties
      * `"agricultural_area_use"`: area of agricultural properties by use
      * `"agricultural_employees_tractors"`: number of employees and tractors in agricultural properties
      * `"agricultural_producer_condition"`: condition of agricultural producer, whether they own the land
      * `"animal_production"`: number of animals farmed, by species
      * `"animal_products"`: amount of animal products, by product type
      * `"vegetable_production_area"`: area and amount produced, by vegetable product
      * `"vegetable_production_temporary"`: amount produced, by temporary crop
      * `"vegetable_production_permanent"`: amount produced, by permanent crop
      * `"livestock_production"`: amount of bovine cattle, and number of agricultural properties

  2.  **raw_data**: there are two options:

      * `TRUE`: if you want the data as it is originally.
      * `FALSE`: if you want the treated version of the data.

  3. **geo_level**: `"country"` or `"state"`. For dataset `"livestock_production"`, it can also be `"municipality"`   
  
  4.  **time_period**: picks the years for which the data will be
    downloaded:
      * For datasets `"agricultural_land_area"`, `"agricultural_producer_condition"`, `"animal_products"`, and `"vegetable_production_area"`, it can be one of 1920, 1940, 1950, 1960, 1970, 1975, 1980, 1985, 1995, or 2006.
      * For datasets `"vegetable_production_permanent"` and `"vegetable_production_permanent"`, it can only be from 1940 onwards
      * For datasets `"agricultural_area_use"`, `"agricultural_employees_tractors"`, `"animal_production"`, it can only be from 1970 onwards
      * For dataset `"livestock_production"`, it can only be 2017

  5.  **language**: you can choose between Portuguese `("pt")` and English
    `("eng")`
    
***

**Examples:**
```{r eval=FALSE}
# Download total land area data at the country level in year 2006
data <- load_censoagro(
  dataset = "agricultural_land_area",
  raw_data = TRUE,
  geo_level = "country",
  time_period = 2006
)

# Download temporary production crops data by state (geo_level = "state") in year 2006
# in portuguese (language = "pt")
data <- load_censoagro(
  dataset = "vegetable_production_temporary",
  raw_data = FALSE,
  geo_level = "state",
  time_period = 1996,
  language = "pt"
)
```
