Title: | Simplify Access to Data from the Amazon Region |
---|---|
Description: | Functions to download and treat data regarding the Brazilian Amazon region from a variety of official sources. |
Authors: | Igor Rigolon Veiga [aut, cre], DataZoom (PUC-Rio) [fnd], Guilherme Jardim [aut], Daniel AC Barbosa [aut], Bruno Alcantara Duarte [aut], Fredie Didier [aut], Tito Bruni [aut], Luiz Guilherme Lopes Moussatche [aut], Victor Aliende da Matta [aut], Anna Carolina Dutra Saraiva [aut], Arthur Carvalho Brito [aut], Francisco de Lima Cavalcanti [aut], Maria Mittelbach [aut] |
Maintainer: | Igor Rigolon Veiga <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.0 |
Built: | 2025-01-22 04:43:12 UTC |
Source: | https://github.com/cran/datazoom.amazonia |
This function allows you decompress a DBC file into its DBF counterpart. Please note that this is the file format used by the Brazilian Ministry of Health (DATASUS), and it is not related to the FoxPro or CANdb DBC file formats.
dbc2dbf(input.file, output.file)
dbc2dbf(input.file, output.file)
input.file |
The name of the DBC file (including extension) |
output.file |
The output file name (including extension) |
DBC is the extension for compressed DBF files (from the 'XBASE' family of databases). This is a proprietary file format used by the brazilian government to make available public healthcare datasets (by it's agency called DATASUS).
It uses internally the PKWare's Data Compression Library (DCL) "implode" compression algorithm. When decompressed, it becomes a regular DBF file.
Return TRUE if succeded, FALSE otherwise.
Daniela Petruzalek, [email protected]
The internal C code for dbc2dbf
is based on blast
decompressor and blast-dbf
(see References).
The PKWare ZIP file format documentation (contains the "implode" algorithm specification) available at https://support.pkware.com, current version https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT.
blast
source code in C: https://github.com/madler/zlib/tree/master/contrib/blast
blast-dbf
, DBC to DBF command-line decompression tool: https://github.com/eaglebh/blast-dbf
read.dbc
## Not run: # Input file name in.f <- system.file("files/sids.dbc", package = "read.dbc") # Output file name out.f <- tempfile(fileext = ".dbc") # The call return logi = TRUE on success if (dbc2dbf(input.file = in.f, output.file = out.f)) { print("File decompressed!") file.remove(out.f) } ## End(Not run)
## Not run: # Input file name in.f <- system.file("files/sids.dbc", package = "read.dbc") # Output file name out.f <- tempfile(fileext = ".dbc") # The call return logi = TRUE on success if (dbc2dbf(input.file = in.f, output.file = out.f)) { print("File decompressed!") file.remove(out.f) } ## End(Not run)
National Electric Energy Agency - ANEEL
load_aneel(dataset, raw_data = FALSE, language = "eng")
load_aneel(dataset, raw_data = FALSE, language = "eng")
dataset |
A dataset name ("energy_development_budget", "energy_generation" or "energy_enterprises_distributed") |
raw_data |
A |
language |
A |
## Not run: # download treated data about energy generation clean_aneel <- load_aneel( dataset = "energy_generation", raw_data = FALSE ) ## End(Not run)
## Not run: # download treated data about energy generation clean_aneel <- load_aneel( dataset = "energy_generation", raw_data = FALSE ) ## End(Not run)
Loads disaggregated data on bilateral trade flows for more than 5000 products and 200 countries.
load_baci(dataset = "HS92", raw_data = FALSE, time_period, language = "eng")
load_baci(dataset = "HS92", raw_data = FALSE, time_period, language = "eng")
dataset |
A dataset name ("HS92"). |
raw_data |
A |
time_period |
A |
language |
A |
A tibble
.
## Not run: # download treated data for 2016 (takes a long time to download) clean_baci <- load_baci( raw_data = FALSE, time_period = 2016 ) ## End(Not run)
## Not run: # download treated data for 2016 (takes a long time to download) clean_baci <- load_baci( raw_data = FALSE, time_period = 2016 ) ## End(Not run)
Loads data on all products imported to or exported from Brazil.
load_br_trade(dataset, raw_data = FALSE, time_period, language = "eng")
load_br_trade(dataset, raw_data = FALSE, time_period, language = "eng")
dataset |
A dataset name ("comex_export_mun", "comex_import_mun", "comex_export_prod" or "comex_import_prod"). |
raw_data |
A |
time_period |
A |
language |
A |
A tibble
.
## Not run: # download treated (raw_data = FALSE) exports data by municipality (dataset = "comex_export_mun") # from 2020 to 2021 (time_period = 2020:2021) data <- load_br_trade( dataset = "comex_export_mun", raw_data = FALSE, time_period = 2020:2021 ) # download treated(raw_data = FALSE) imports data by municipality (dataset = "comex_import_mun") # from 2020 to 2021 (time_period = 2020:2021) data <- load_br_trade( dataset = "comex_import_mun", raw_data = FALSE, time_period = 2020:2021 ) ## End(Not run)
## Not run: # download treated (raw_data = FALSE) exports data by municipality (dataset = "comex_export_mun") # from 2020 to 2021 (time_period = 2020:2021) data <- load_br_trade( dataset = "comex_export_mun", raw_data = FALSE, time_period = 2020:2021 ) # download treated(raw_data = FALSE) imports data by municipality (dataset = "comex_import_mun") # from 2020 to 2021 (time_period = 2020:2021) data <- load_br_trade( dataset = "comex_import_mun", raw_data = FALSE, time_period = 2020:2021 ) ## End(Not run)
Loads information on companies and other organizations and their respective formally constituted local units, registered with the CNPJ - National Register of Legal Entities.
load_cempre( dataset = "cempre", raw_data = FALSE, geo_level, time_period, language = "eng", sectors = FALSE )
load_cempre( dataset = "cempre", raw_data = FALSE, geo_level, time_period, language = "eng", sectors = FALSE )
dataset |
A dataset name ("cempre"). |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
sectors |
A |
A tibble
.
## Not run: # Download raw data (raw_data = TRUE) at the country level # from 2008 to 2010 (time_period = 2008:2010). data <- load_cempre( raw_data = TRUE, geo_level = "country", time_period = 2008:2010 ) # Download treted data (raw_data = FALSE) by state (geo_level = "state") # from 2008 to 2010 (time_period = 2008:2010) in portuguese (language = "pt"). # In this example, data is split by sector (sectors = TRUE) data <- load_cempre( raw_data = FALSE, geo_level = "state", time_period = 2008:2010, language = "pt", sectors = TRUE ) ## End(Not run)
## Not run: # Download raw data (raw_data = TRUE) at the country level # from 2008 to 2010 (time_period = 2008:2010). data <- load_cempre( raw_data = TRUE, geo_level = "country", time_period = 2008:2010 ) # Download treted data (raw_data = FALSE) by state (geo_level = "state") # from 2008 to 2010 (time_period = 2008:2010) in portuguese (language = "pt"). # In this example, data is split by sector (sectors = TRUE) data <- load_cempre( raw_data = FALSE, geo_level = "state", time_period = 2008:2010, language = "pt", sectors = TRUE ) ## End(Not run)
Loads information on agricultural establishments and activities
load_censoagro( dataset, raw_data = FALSE, geo_level, time_period, language = "eng" )
load_censoagro( dataset, raw_data = FALSE, geo_level, time_period, language = "eng" )
dataset |
A dataset name ("agricultural_land_area", "agricultural_area_use", "agricultural_employees_tractors", "agricultural_producer_condition", "animal_species", "animal_products", "vegetable_production_area", "vegetable_production_permanent", "vegetable_production_temporary", "livestock_production"). |
raw_data |
A |
geo_level |
A
|
time_period |
A |
language |
A |
A tibble
.
## Not run: # 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" ) ## End(Not run) ## We should include support for microregion/mesoregion
## Not run: # 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" ) ## End(Not run) ## We should include support for microregion/mesoregion
Spatial data on climate variables, extracted from Climatology Lab's TerraClimate.
load_climate( dataset, raw_data = FALSE, time_period, language = "eng", legal_amazon_only = FALSE )
load_climate( dataset, raw_data = FALSE, time_period, language = "eng", legal_amazon_only = FALSE )
dataset |
A dataset name, choosing which variable will be loaded. One of ("max_temperature", "min_temperature", "wind_speed", "vapor_pressure_deficit", "vapor_pressure", "snow_water_equivalent", "shortwave_radiation_flux", "soil_moisture", "runoff", "precipitation", "potential_evaporation", "climatic_water_deficit", "water_evaporation", "palmer_drought_severity_index"). For extra details, try |
raw_data |
A |
time_period |
A |
language |
A |
legal_amazon_only |
A |
A tibble
.
## Not run: # Downloading maximum temperature data from 2000 to 2001 max_temp <- load_climate(dataset = "max_temperature", time_period = 2000:2001) # Downloading precipitation data only for the legal Amazon in 2010 amz_precipitation <- load_climate( dataset = "precipitation", time_period = 2010, legal_amazon_only = TRUE ) ## End(Not run)
## Not run: # Downloading maximum temperature data from 2000 to 2001 max_temp <- load_climate(dataset = "max_temperature", time_period = 2000:2001) # Downloading precipitation data only for the legal Amazon in 2010 amz_precipitation <- load_climate( dataset = "precipitation", time_period = 2010, legal_amazon_only = TRUE ) ## End(Not run)
Loads DATASUS data on health establishments, mortality, access to health services and several health indicators.
load_datasus( dataset, time_period, states = "all", raw_data = FALSE, keep_all = FALSE, language = "eng" )
load_datasus( dataset, time_period, states = "all", raw_data = FALSE, keep_all = FALSE, language = "eng" )
dataset |
A dataset name, can be one of ("datasus_sim_do", "datasus_sih", "datasus_cnes_lt"), or more. For more details, try |
time_period |
A |
states |
A |
raw_data |
A |
keep_all |
A |
language |
A |
A tibble
.
## Not run: # download raw data for the year 2010 in the state of AM. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = "AM", raw_data = TRUE ) # download treated data with the number of deaths by cause in AM and PA. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = c("AM", "PA"), raw_data = FALSE ) # download treated data with the number of deaths by cause in AM and PA # keeping all individual variables. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = c("AM", "PA"), raw_data = FALSE, keep_all = TRUE ) ## End(Not run)
## Not run: # download raw data for the year 2010 in the state of AM. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = "AM", raw_data = TRUE ) # download treated data with the number of deaths by cause in AM and PA. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = c("AM", "PA"), raw_data = FALSE ) # download treated data with the number of deaths by cause in AM and PA # keeping all individual variables. data <- load_datasus( dataset = "datasus_sim_do", time_period = 2010, states = c("AM", "PA"), raw_data = FALSE, keep_all = TRUE ) ## End(Not run)
Loads information on forest degradation in the Brazilian Amazon, replaced by DETER-B in December 2016.
load_degrad( dataset = "degrad", raw_data = FALSE, time_period, language = "eng" )
load_degrad( dataset = "degrad", raw_data = FALSE, time_period, language = "eng" )
dataset |
A dataset name ("degrad"). |
raw_data |
A |
time_period |
A |
language |
A |
A list
of tibbles (if raw_data
= TRUE
) or a tibble (if raw_data
= FALSE
).
## Not run: # download treated data (raw_data = TRUE) related to forest degradation # from 2010 to 2012 (time_period = 2010:2012). data <- load_degrad( dataset = "degrad", raw_data = FALSE, time_period = 2010:2012 ) ## End(Not run)
## Not run: # download treated data (raw_data = TRUE) related to forest degradation # from 2010 to 2012 (time_period = 2010:2012). data <- load_degrad( dataset = "degrad", raw_data = FALSE, time_period = 2010:2012 ) ## End(Not run)
Loads data on changes in forest cover in the Legal Amazon and the Cerrado biome.
load_deter(dataset, raw_data = FALSE, language = "eng")
load_deter(dataset, raw_data = FALSE, language = "eng")
dataset |
A dataset name ("deter_amz", "deter_cerrado") with information about the Legal Amazon and Cerrado, respectively |
raw_data |
A |
language |
A |
A sf
object.
## Not run: # Download treated data (raw_data = FALSE) from Amazonia (dataset = "deter_amz") deter_amz <- load_deter( dataset = "deter_amz", raw_data = FALSE ) ## End(Not run)
## Not run: # Download treated data (raw_data = FALSE) from Amazonia (dataset = "deter_amz") deter_amz <- load_deter( dataset = "deter_amz", raw_data = FALSE ) ## End(Not run)
Electrical Energy Monthly Consumption per Class
load_epe(dataset, raw_data = FALSE, geo_level = "state", language = "eng")
load_epe(dataset, raw_data = FALSE, geo_level = "state", language = "eng")
dataset |
A dataset name, ("energy_consumption_per_class") or ("national_energy_balance") |
raw_data |
A |
geo_level |
A geographical level, ("state") or ("subsystem"), only available for "energy_consumption_per_class" |
language |
A |
## Not run: # download treated data about energy consumption at the state level clean_epe <- load_epe( dataset = "energy_consumption_per_class", geo_level = "state", raw_data = FALSE ) ## End(Not run)
## Not run: # download treated data about energy consumption at the state level clean_epe <- load_epe( dataset = "energy_consumption_per_class", geo_level = "state", raw_data = FALSE ) ## End(Not run)
Loads information on environmental fines in the Amazon region
load_ibama(dataset, raw_data = FALSE, states = "all", language = "eng")
load_ibama(dataset, raw_data = FALSE, states = "all", language = "eng")
dataset |
A dataset name ("embargoed_areas", "distributed_fines", or "collected_fines") |
raw_data |
A |
states |
A |
language |
A |
A tibble
.
## Not run: # Download treated embargoes data (raw_data = FALSE) in english (language = "eng") data <- load_ibama( dataset = "embargoed_areas", raw_data = FALSE, language = "eng" ) # Download treated collected fines data from "BA" data <- load_ibama( dataset = "collected_fines", raw_data = FALSE, states = "BA", language = "pt" ) ## End(Not run)
## Not run: # Download treated embargoes data (raw_data = FALSE) in english (language = "eng") data <- load_ibama( dataset = "embargoed_areas", raw_data = FALSE, language = "eng" ) # Download treated collected fines data from "BA" data <- load_ibama( dataset = "collected_fines", raw_data = FALSE, states = "BA", language = "pt" ) ## End(Not run)
Loads information on electric energy access at the municipality level in the Amazon region
load_iema(dataset = "iema", raw_data = FALSE, language = "eng")
load_iema(dataset = "iema", raw_data = FALSE, language = "eng")
dataset |
A dataset name ("iema") |
raw_data |
A |
language |
A |
A tibble
.
## Not run: # Download treated data data <- load_iema(raw_data = FALSE) ## End(Not run)
## Not run: # Download treated data data <- load_iema(raw_data = FALSE) ## End(Not run)
Loads data categorizing each municipality by the level of deforestation pressure it faces
load_imazon(dataset = "imazon_shp", raw_data = FALSE, language = "eng")
load_imazon(dataset = "imazon_shp", raw_data = FALSE, language = "eng")
dataset |
There is one dataset available ("imazon_shp") |
raw_data |
A |
language |
A |
A tibble
.
## Not run: # Download treated data data <- load_imazon(raw_data = FALSE) ## End(Not run)
## Not run: # Download treated data data <- load_imazon(raw_data = FALSE) ## End(Not run)
Loads information on the social and environmental performance of the Legal Amazon.
load_ips( dataset = "all", raw_data = FALSE, time_period = c(2014, 2018, 2021, 2023), language = "eng" )
load_ips( dataset = "all", raw_data = FALSE, time_period = c(2014, 2018, 2021, 2023), language = "eng" )
dataset |
A dataset name ("all", "life_quality", "sanit_habit", "violence", "educ", "communic", "mortality", or "deforest") |
raw_data |
A |
time_period |
Year to download. Can be 2014, 2018, 2021, 2023, or a vector with some combination thereof |
language |
A |
A tibble
.
## Not run: # Download raw data from 2014 data <- load_ips(dataset = "all", raw_data = TRUE, time_period = 2014) # Download treated deforest data from 2018 in portuguese data <- load_ips( dataset = "deforest", raw_data = FALSE, time_period = 2018, language = "pt" ) ## End(Not run)
## Not run: # Download raw data from 2014 data <- load_ips(dataset = "all", raw_data = TRUE, time_period = 2014) # Download treated deforest data from 2018 in portuguese data <- load_ips( dataset = "deforest", raw_data = FALSE, time_period = 2018, language = "pt" ) ## End(Not run)
Loads information about land cover and use
load_mapbiomas( dataset, raw_data = FALSE, geo_level = "municipality", language = "eng" )
load_mapbiomas( dataset, raw_data = FALSE, geo_level = "municipality", language = "eng" )
dataset |
A dataset name ("mapbiomas_cover", "mapbiomas_transition", "mapbiomas_irrigation", "mapbiomas_deforestation_regeneration", "mapbiomas_mining", "mapbiomas_water" or "mapbiomas_fire") |
raw_data |
A |
geo_level |
A
|
language |
A |
A tibble
.
## Not run: # download treated Mapbiomas Cover data in English data <- load_mapbiomas( dataset = "mapbiomas_cover", raw_data = FALSE, geo_level = "municipality", language = "eng" ) # download treated data on mining on indigenous lands data <- load_mapbiomas("mapbiomas_mining", raw_data = FALSE, geo_level = "indigenous_land" ) ## End(Not run)
## Not run: # download treated Mapbiomas Cover data in English data <- load_mapbiomas( dataset = "mapbiomas_cover", raw_data = FALSE, geo_level = "municipality", language = "eng" ) # download treated data on mining on indigenous lands data <- load_mapbiomas("mapbiomas_mining", raw_data = FALSE, geo_level = "indigenous_land" ) ## End(Not run)
Loads information on the quantity, value and area of temporary and permanent crops cultivated.
load_pam(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
load_pam(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
dataset |
A dataset name ("all_crops", "permanent_crops", "temporary_crops" or many individual crop possibilities (see |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
A tibble
consisting of geographic units that present positive values for any of the variables in the dataset.
## Not run: # download treated data at the state level from 2010 to 2011 for all crops data <- load_pam( dataset = "all_crops", raw_data = FALSE, geo_level = "state", time_period = 2010:2011, language = "eng" ) ## End(Not run)
## Not run: # download treated data at the state level from 2010 to 2011 for all crops data <- load_pam( dataset = "all_crops", raw_data = FALSE, geo_level = "state", time_period = 2010:2011, language = "eng" ) ## End(Not run)
Loads information on the amount and value of the production of the exploitation of native plant resources and planted forest massifs, as well as existing total and harvested areas of forest crops.
load_pevs(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
load_pevs(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
dataset |
A dataset name ("pevs_forest_crops", "pevs_silviculture" or "pevs_silviculture_area"). You can also use SIDRA codes (see https://sidra.ibge.gov.br/pesquisa/pevs/quadros/brasil/2019) |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
A tibble
consisting of geographic units that present positive values for any of the variables in the dataset.
## Not run: # Download treated (raw_data = FALSE) silviculture data (dataset = 'pevs_silviculture') # by state (geo_level = 'state') from 2012 (time_period = 2012) # in portuguese (language = "pt") data <- load_pevs( dataset = "pevs_silviculture", raw_data = FALSE, geo_level = "state", time_period = 2012, language = "pt" ) # Download raw (raw_data = TRUE) forest crops data by region from 2012 to 2013 in english data <- load_pevs( dataset = "pevs_forest_crops", raw_data = TRUE, geo_level = "region", time_period = 2012:2013 ) ## End(Not run)
## Not run: # Download treated (raw_data = FALSE) silviculture data (dataset = 'pevs_silviculture') # by state (geo_level = 'state') from 2012 (time_period = 2012) # in portuguese (language = "pt") data <- load_pevs( dataset = "pevs_silviculture", raw_data = FALSE, geo_level = "state", time_period = 2012, language = "pt" ) # Download raw (raw_data = TRUE) forest crops data by region from 2012 to 2013 in english data <- load_pevs( dataset = "pevs_forest_crops", raw_data = TRUE, geo_level = "region", time_period = 2012:2013 ) ## End(Not run)
Loads information on gross domestic product at current prices, taxes, net of subsidies, on products at current prices and gross value added at current prices, total and by economic activity, and respective shares.
load_pibmunic( dataset = "pibmunic", raw_data = FALSE, geo_level, time_period, language = "eng" )
load_pibmunic( dataset = "pibmunic", raw_data = FALSE, geo_level, time_period, language = "eng" )
dataset |
A dataset name ("pibmunic") with Municipal GDP information. You can also use SIDRA codes (See https://sidra.ibge.gov.br/pesquisa/pib-munic/tabelas) |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
A tibble
.
## Not run: # download treated municipal GDP data at the state level for 2010 to 2012 data <- load_pibmunic( raw_data = FALSE, geo_level = "state", time_period = 2010:2012 ) ## End(Not run)
## Not run: # download treated municipal GDP data at the state level for 2010 to 2012 data <- load_pibmunic( raw_data = FALSE, geo_level = "state", time_period = 2010:2012 ) ## End(Not run)
Loads information on (estimated) population
load_population( dataset = "population", raw_data = FALSE, geo_level, time_period, language = "eng" )
load_population( dataset = "population", raw_data = FALSE, geo_level, time_period, language = "eng" )
dataset |
A dataset name ("population"). |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
A tibble
.
## Not run: # Download raw data (raw_data = TRUE) at the country level # from 2008 to 2010 (time_period = 2008:2010). data <- load_population( raw_data = TRUE, geo_level = "country", time_period = 2008:2010 ) # Download treted data (raw_data = FALSE) by state (geo_level = "state") # from 2008 to 2010 (time_period = 2008:2010) in portuguese (language = "pt"). data <- load_population( raw_data = FALSE, geo_level = "state", time_period = 2008:2010, language = "pt" ) ## End(Not run)
## Not run: # Download raw data (raw_data = TRUE) at the country level # from 2008 to 2010 (time_period = 2008:2010). data <- load_population( raw_data = TRUE, geo_level = "country", time_period = 2008:2010 ) # Download treted data (raw_data = FALSE) by state (geo_level = "state") # from 2008 to 2010 (time_period = 2008:2010) in portuguese (language = "pt"). data <- load_population( raw_data = FALSE, geo_level = "state", time_period = 2008:2010, language = "pt" ) ## End(Not run)
Loads information on animal farming inventories and livestock products (IBGE).
load_ppm(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
load_ppm(dataset, raw_data = FALSE, geo_level, time_period, language = "eng")
dataset |
A dataset name ("ppm_livestock_inventory", "ppm_sheep_farming", "ppm_animal_orig_production", "ppm_cow_farming" or "ppm_aquaculture". You can also use SIDRA codes (see https://sidra.ibge.gov.br/pesquisa/ppm/tabelas/brasil/2021) |
raw_data |
A |
geo_level |
A |
time_period |
A |
language |
A |
A tibble
consisting of geographic units that present positive values for any of the variables in the dataset.
## Not run: # Download treated data (raw_data = FALSE) about aquaculture (dataset = "ppm_aquaculture") # from 2013 to 2015 (time_period = 2013:2015) in english # with the level of aggregation being the country (geo_level = "country"). data <- load_ppm( dataset = "ppm_aquaculture", raw_data = FALSE, geo_level = "country", time_period = 2013:2015 ) # Download raw data about sheep farming by state from 1980 to 1995 in portuguese (language = "pt") data <- load_ppm( dataset = "ppm_sheep_farming", raw_data = TRUE, geo_level = "state", time_period = 1980:1995, language = "pt" ) ## End(Not run)
## Not run: # Download treated data (raw_data = FALSE) about aquaculture (dataset = "ppm_aquaculture") # from 2013 to 2015 (time_period = 2013:2015) in english # with the level of aggregation being the country (geo_level = "country"). data <- load_ppm( dataset = "ppm_aquaculture", raw_data = FALSE, geo_level = "country", time_period = 2013:2015 ) # Download raw data about sheep farming by state from 1980 to 1995 in portuguese (language = "pt") data <- load_ppm( dataset = "ppm_sheep_farming", raw_data = TRUE, geo_level = "state", time_period = 1980:1995, language = "pt" ) ## End(Not run)
Loads data on deforestation in the Legal Amazon region.
load_prodes(dataset, raw_data = FALSE, language = "eng")
load_prodes(dataset, raw_data = FALSE, language = "eng")
dataset |
A dataset name ("deforestation"). |
raw_data |
A |
language |
A |
A tibble
with the selected data.
## Not run: # Download treated data (raw_data = FALSE) # in portuguese (language = 'pt'). data <- load_prodes( raw_data = FALSE, language = "pt" ) ## End(Not run)
## Not run: # Download treated data (raw_data = FALSE) # in portuguese (language = 'pt'). data <- load_prodes( raw_data = FALSE, language = "pt" ) ## End(Not run)
Loads data of estimates of emission of greenhouse gases
load_seeg(dataset, raw_data = FALSE, geo_level, language = "eng")
load_seeg(dataset, raw_data = FALSE, geo_level, language = "eng")
dataset |
A dataset name ("seeg", seeg_farming", "seeg_industry", "seeg_energy", "seeg_land", "seeg_residuals"). On which "seeg" contains all five sectors (only works with raw_data = TRUE) and the others are filtered specifically by a main source of emission. |
raw_data |
A |
geo_level |
A |
language |
A |
A tibble
.
## Not run: # Download raw data (raw_data = TRUE) of greenhouse gases (dataset = "seeg") # by state (geo_level = "state") data <- load_seeg( dataset = "seeg", raw_data = TRUE, geo_level = "state" ) # Download treated data (raw_data = FALSE) of industry greenhouse gases (dataset = "seeg_industry") data <- load_seeg( dataset = "seeg_industry", raw_data = FALSE, geo_level = "state" ) ## End(Not run)
## Not run: # Download raw data (raw_data = TRUE) of greenhouse gases (dataset = "seeg") # by state (geo_level = "state") data <- load_seeg( dataset = "seeg", raw_data = TRUE, geo_level = "state" ) # Download treated data (raw_data = FALSE) of industry greenhouse gases (dataset = "seeg_industry") data <- load_seeg( dataset = "seeg_industry", raw_data = FALSE, geo_level = "state" ) ## End(Not run)
Loads information the mines being explored legally in Brazil, including their location, status, product being mined and area in square meters.
load_sigmine(dataset = "sigmine_active", raw_data = FALSE, language = "eng")
load_sigmine(dataset = "sigmine_active", raw_data = FALSE, language = "eng")
dataset |
A dataset name ("sigmine_active") |
raw_data |
A |
language |
A |
A tibble
.
## Not run: # Download treated data (raw_data = FALSE) in portuguese (language = "pt"). data <- load_sigmine( dataset = "sigmine_active", raw_data = FALSE, language = "pt" ) ## End(Not run)
## Not run: # Download treated data (raw_data = FALSE) in portuguese (language = "pt"). data <- load_sigmine( dataset = "sigmine_active", raw_data = FALSE, language = "pt" ) ## End(Not run)
A dataset containing each municipality's IBGE code, state, mesoregion, microregion, as well as a binary variable for whether it is part of the Legal Amazon. Mostly for our functions' internal use.
municipalities
municipalities
A data frame with 5570 rows and 12 variables:
IBGE 7-digit municipality code
municipality name
2-digit state code
state abbreviations (e.g. "AM")
full name of the states
1-digit regional code
name of the region
takes value 1 for municipalities in the legal amazon, 0 otherwise
municipality name in MAPBIOMAS data
5-digit microregion code
name of the microregion
4-digit mesoregion code
name of the mesoregion
Package geobr
and https://www.ibge.gov.br/geociencias/cartas-e-mapas/mapas-regionais/15819-amazonia-legal.html?=&t=acesso-ao-produto
A dataset containing each municipality-biome's IBGE code, state, biome, name and MAPBIOMAS ID. Mostly for our functions' internal use.
municipalities_biomes
municipalities_biomes
A data frame with 6537 rows and 4 variables:
MAPBIOMAS biome-municipality ID
IBGE 7-digit municipality code
state abbreviations (e.g. "AM")
municipality name in MAPBIOMAS data
biome
Package geobr
and https://mapbiomas.org/
This function allows you to read a DBC (compressed DBF) file into a data frame. Please note that this is the file format used by the Brazilian Ministry of Health (DATASUS), and it is not related to the FoxPro or CANdb DBC file formats.
read.dbc(file, ...)
read.dbc(file, ...)
file |
The name of the DBC file (including extension) |
... |
Further arguments to be passed to |
DBC is the extension for compressed DBF files (from the 'XBASE' family of databases). This is a proprietary file format used by the brazilian government to make available public healthcare datasets (by it's agency called DATASUS).
read.dbc
relies on the dbc2dbf
function to decompress the DBC into a temporary DBF file.
After decompressing, it reads the temporary DBF file into a data.frame
using read.dbf
from the foreign
package.
A data.frame of the data from the DBC file.
DATASUS is the name of the Department of Informatics of the Brazilian Health System and is responsible for publishing public healthcare data. Besides the DATASUS, the Brazilian National Agency for Supplementary Health (ANS) also uses this file format for its public data.
This function was tested using files from both DATASUS and ANS to ensure compliance with the format, and hence ensure its usability by researchers.
As a final note, neither this project, nor its author, has any association with the brazilian government.
Daniela Petruzalek, [email protected]
dbc2dbf
## Not run: # The 'sids.dbc' file is the compressed version of 'sids.dbf' from the "foreign" package. x <- read.dbc(system.file("files/sids.dbc", package = "read.dbc")) str(x) summary(x) # This is a small subset of U.S. NOAA storm database. storm <- read.dbc(system.file("files/storm.dbc", package = "read.dbc")) head(x) str(x) ## Don't run! ## The following code will download data from the "Declarations of Death" database for ## the Brazilian state of Parana, year 2013. Source: DATASUS / Brazilian Ministry of Health url <- "ftp://ftp.datasus.gov.br/dissemin/publicos/SIM/CID10/DORES/DOPR2013.dbc" download.file(url, destfile = "DOPR2013.dbc") dopr <- read.dbc("DOPR2013.dbc") head(dopr) str(dopr) ## End(Not run)
## Not run: # The 'sids.dbc' file is the compressed version of 'sids.dbf' from the "foreign" package. x <- read.dbc(system.file("files/sids.dbc", package = "read.dbc")) str(x) summary(x) # This is a small subset of U.S. NOAA storm database. storm <- read.dbc(system.file("files/storm.dbc", package = "read.dbc")) head(x) str(x) ## Don't run! ## The following code will download data from the "Declarations of Death" database for ## the Brazilian state of Parana, year 2013. Source: DATASUS / Brazilian Ministry of Health url <- "ftp://ftp.datasus.gov.br/dissemin/publicos/SIM/CID10/DORES/DOPR2013.dbc" download.file(url, destfile = "DOPR2013.dbc") dopr <- read.dbc("DOPR2013.dbc") head(dopr) str(dopr) ## End(Not run)