From 8235a1f0249bd8b163cf5072e23946e204494721 Mon Sep 17 00:00:00 2001 From: rafapereirabr Date: Mon, 2 Sep 2024 10:13:16 -0300 Subject: [PATCH] Functions now include a `cache` parameter --- r-package/NEWS.md | 1 + r-package/R/read_amazon.R | 10 ++++++++-- r-package/R/read_biomes.R | 10 ++++++++-- r-package/R/read_capitals.R | 3 ++- r-package/R/read_census_tract.R | 16 +++++++++++++--- r-package/R/read_comparable_areas.R | 11 +++++++++-- r-package/R/read_conservation_units.R | 10 ++++++++-- r-package/R/read_country.R | 10 ++++++++-- r-package/R/read_disaster_risk_area.R | 10 ++++++++-- r-package/R/read_health_facilities.R | 9 +++++++-- r-package/R/read_health_region.R | 11 +++++++++-- r-package/R/read_immediate_region.R | 11 +++++++++-- r-package/R/read_indigenous_land.R | 10 ++++++++-- r-package/R/read_intermediate_region.R | 11 +++++++++-- r-package/R/read_meso_region.R | 12 +++++++++--- r-package/R/read_metro_area.R | 8 ++++++-- r-package/R/read_micro_region.R | 18 ++++++++++++------ r-package/R/read_municipal_seat.R | 9 +++++++-- r-package/R/read_municipality.R | 4 +++- r-package/R/read_neighborhood.R | 10 ++++++++-- r-package/R/read_pop_arrangements.R | 10 ++++++++-- r-package/R/read_region.R | 9 ++++++--- r-package/R/read_schools.R | 9 +++++++-- r-package/R/read_semiarid.R | 11 ++++++++--- r-package/R/read_state.R | 20 +++++++++++++++----- r-package/R/read_statistical_grid.R | 18 ++++++++++++++---- r-package/R/read_urban_area.R | 8 ++++++-- r-package/R/read_urban_concentrations.R | 10 ++++++++-- r-package/R/read_weighting_area.R | 15 ++++++++++++--- r-package/cran-comments.md | 4 ++-- r-package/man/read_amazon.Rd | 8 +++++++- r-package/man/read_biomes.Rd | 8 +++++++- r-package/man/read_census_tract.Rd | 9 ++++++++- r-package/man/read_comparable_areas.Rd | 9 ++++++++- r-package/man/read_conservation_units.Rd | 13 ++++++++++++- r-package/man/read_country.Rd | 8 +++++++- r-package/man/read_disaster_risk_area.Rd | 13 ++++++++++++- r-package/man/read_health_facilities.Rd | 8 +++++++- r-package/man/read_health_region.Rd | 9 ++++++++- r-package/man/read_immediate_region.Rd | 9 ++++++++- r-package/man/read_indigenous_land.Rd | 13 ++++++++++++- r-package/man/read_intermediate_region.Rd | 9 ++++++++- r-package/man/read_meso_region.Rd | 9 ++++++++- r-package/man/read_metro_area.Rd | 9 ++++++++- r-package/man/read_micro_region.Rd | 9 ++++++++- r-package/man/read_municipal_seat.Rd | 8 +++++++- r-package/man/read_neighborhood.Rd | 13 ++++++++++++- r-package/man/read_pop_arrangements.Rd | 13 ++++++++++++- r-package/man/read_region.Rd | 8 +++++++- r-package/man/read_schools.Rd | 8 +++++++- r-package/man/read_semiarid.Rd | 13 ++++++++++++- r-package/man/read_state.Rd | 9 ++++++++- r-package/man/read_statistical_grid.Rd | 13 ++++++++++++- r-package/man/read_urban_area.Rd | 9 ++++++++- r-package/man/read_urban_concentrations.Rd | 13 ++++++++++++- r-package/man/read_weighting_area.Rd | 9 ++++++++- 56 files changed, 471 insertions(+), 96 deletions(-) diff --git a/r-package/NEWS.md b/r-package/NEWS.md index 6c6deb0b..1ae79361 100644 --- a/r-package/NEWS.md +++ b/r-package/NEWS.md @@ -3,6 +3,7 @@ **Minor changes** +- Functions now include a `cache` parameter that allows users to decide whehter to keep files in cache or to force downloading them again. At the moment, files are only cached during the R session, but this is a step toward future version of geobr that will be based on permanent caching. - Now using `curl::multi_download()` to download files in parallel - {geobr} now imports {fs} to use robust cross-platform file system operations - Removed dependency on the {httr} package diff --git a/r-package/R/read_amazon.R b/r-package/R/read_amazon.R index 4e4a24fd..e9c141f6 100644 --- a/r-package/R/read_amazon.R +++ b/r-package/R/read_amazon.R @@ -8,6 +8,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2012`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -18,7 +19,10 @@ #' # Read Brazilian Legal Amazon #' a <- read_amazon(year = 2012) #' -read_amazon <- function(year=2012, simplified=TRUE, showProgress=TRUE){ +read_amazon <- function(year = 2012, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="amazonia_legal", year=year, simplified=simplified) @@ -30,7 +34,9 @@ read_amazon <- function(year=2012, simplified=TRUE, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_biomes.R b/r-package/R/read_biomes.R index bac10f1c..067c65dc 100644 --- a/r-package/R/read_biomes.R +++ b/r-package/R/read_biomes.R @@ -9,6 +9,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2019`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -19,7 +20,10 @@ #' # Read biomes #' b <- read_biomes(year = 2019) #' -read_biomes <- function(year=2019, simplified=TRUE, showProgress=TRUE){ +read_biomes <- function(year = 2019, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="biomes", year=year, simplified=simplified) @@ -28,7 +32,9 @@ read_biomes <- function(year=2019, simplified=TRUE, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_capitals.R b/r-package/R/read_capitals.R index cc895093..b3d742b2 100644 --- a/r-package/R/read_capitals.R +++ b/r-package/R/read_capitals.R @@ -23,7 +23,8 @@ #' # Read simple data.frame of state capitals #' capitals_df <- read_capitals(as_sf = FALSE) #' -read_capitals <- function(as_sf = TRUE, showProgress = TRUE){ +read_capitals <- function(as_sf = TRUE, + showProgress = TRUE){ # check input if (!is.logical(as_sf)) { stop("'as_sf' must be of type 'logical'") } diff --git a/r-package/R/read_census_tract.R b/r-package/R/read_census_tract.R index 2b994ca9..4a8ee369 100644 --- a/r-package/R/read_census_tract.R +++ b/r-package/R/read_census_tract.R @@ -13,6 +13,7 @@ #' are separate data sets. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -35,7 +36,12 @@ #' # Read all census tracts of the country at a given year #' c <- read_census_tract(code_tract="all", year=2010) #' -read_census_tract <- function(code_tract, year=2010, zone = "urban", simplified=TRUE, showProgress=TRUE){ +read_census_tract <- function(code_tract, + year = 2010, + zone = "urban", + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="census_tract", year=year, simplified=simplified) @@ -70,7 +76,9 @@ read_census_tract <- function(code_tract, year=2010, zone = "urban", simplified= file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -105,7 +113,9 @@ read_census_tract <- function(code_tract, year=2010, zone = "urban", simplified= } # download files - sf <- download_gpkg(file_url, showProgress = showProgress) + sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_comparable_areas.R b/r-package/R/read_comparable_areas.R index 29ad0b7b..5a67b393 100644 --- a/r-package/R/read_comparable_areas.R +++ b/r-package/R/read_comparable_areas.R @@ -14,6 +14,7 @@ #' to `2010`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -30,7 +31,11 @@ #' @examplesIf identical(tolower(Sys.getenv("NOT_CRAN")), "true") #' amc <- read_comparable_areas(start_year=1970, end_year=2010) #' -read_comparable_areas <- function(start_year=1970, end_year=2010, simplified=TRUE, showProgress=TRUE){ +read_comparable_areas <- function(start_year = 1970, + end_year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # tests years_available <- c(1872,1900,1911,1920,1933,1940,1950,1960,1970,1980,1991,2000,2010) @@ -55,7 +60,9 @@ read_comparable_areas <- function(start_year=1970, end_year=2010, simplified=TRU file_url <- file_url[ file_url %like% target_year] # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_conservation_units.R b/r-package/R/read_conservation_units.R index 8aef78d1..fdcd8d90 100644 --- a/r-package/R/read_conservation_units.R +++ b/r-package/R/read_conservation_units.R @@ -8,6 +8,7 @@ #' @param date Numeric. Date of the data in YYYYMM format. Defaults to `201909`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -18,7 +19,10 @@ #' # Read conservation_units #' b <- read_conservation_units(date = 201909) #' -read_conservation_units <- function(date=201909, simplified=TRUE, showProgress=TRUE){ +read_conservation_units <- function(date = 201909, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="conservation_units", year=date, simplified=simplified) @@ -27,7 +31,9 @@ read_conservation_units <- function(date=201909, simplified=TRUE, showProgress=T file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_country.R b/r-package/R/read_country.R index fecd31ab..be725e83 100644 --- a/r-package/R/read_country.R +++ b/r-package/R/read_country.R @@ -6,6 +6,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2010`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -16,7 +17,10 @@ #' # Read specific year #' br <- read_country(year = 2018) #' -read_country <- function(year=2010, simplified=TRUE, showProgress=TRUE){ +read_country <- function(year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="country", year=year, simplified=simplified) @@ -28,7 +32,9 @@ read_country <- function(year=2010, simplified=TRUE, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_disaster_risk_area.R b/r-package/R/read_disaster_risk_area.R index 5c83c7c2..e3b73f57 100644 --- a/r-package/R/read_disaster_risk_area.R +++ b/r-package/R/read_disaster_risk_area.R @@ -14,6 +14,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2010`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -24,7 +25,10 @@ #' # Read all disaster risk areas in an specific year #' d <- read_disaster_risk_area(year=2010) #' -read_disaster_risk_area <- function(year=2010, simplified=TRUE, showProgress=TRUE){ +read_disaster_risk_area <- function(year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="disaster_risk_area", year=year, simplified=simplified) @@ -33,7 +37,9 @@ read_disaster_risk_area <- function(year=2010, simplified=TRUE, showProgress=TRU file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_health_facilities.R b/r-package/R/read_health_facilities.R index 41bfea98..f1694922 100644 --- a/r-package/R/read_health_facilities.R +++ b/r-package/R/read_health_facilities.R @@ -20,6 +20,7 @@ #' @param date Numeric. Date of the data in YYYYMM format. Defaults to `202303`, #' which was the latest data available by the time of this update. #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -30,7 +31,9 @@ #' # Read all health facilities of the whole country #' h <- read_health_facilities( date = 202303) #' -read_health_facilities <- function(date = 202303, showProgress = TRUE){ +read_health_facilities <- function(date = 202303, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="health_facilities", year=date, simplified=F) @@ -39,7 +42,9 @@ read_health_facilities <- function(date = 202303, showProgress = TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_health_region.R b/r-package/R/read_health_region.R index 86a43a6f..259e3f54 100644 --- a/r-package/R/read_health_region.R +++ b/r-package/R/read_health_region.R @@ -13,6 +13,7 @@ #' regions data. If `TRUE`, the function downloads macro regions data. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -26,7 +27,11 @@ #' # Read all macro health regions #' mhr <- read_health_region( year=2013, macro =TRUE) #' -read_health_region <- function(year=2013, macro=FALSE, simplified=TRUE, showProgress=TRUE){ +read_health_region <- function(year = 2013, + macro = FALSE, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ if(!is.logical(macro)){stop(paste0("Parameter 'macro' must be either TRUE or FALSE"))} @@ -41,7 +46,9 @@ read_health_region <- function(year=2013, macro=FALSE, simplified=TRUE, showProg file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_immediate_region.R b/r-package/R/read_immediate_region.R index 91e7f0d2..a4dd69aa 100644 --- a/r-package/R/read_immediate_region.R +++ b/r-package/R/read_immediate_region.R @@ -12,6 +12,7 @@ #' immediate regions of the country. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -30,7 +31,11 @@ #' im <- read_immediate_region() #' im <- read_immediate_region(code_immediate="all") #' -read_immediate_region <- function(code_immediate="all", year=2019, simplified=TRUE, showProgress=TRUE){ +read_immediate_region <- function(code_immediate = "all", + year = 2019, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="immediate_regions", year=year, simplified=simplified) @@ -42,7 +47,9 @@ read_immediate_region <- function(code_immediate="all", year=2019, simplified=TR file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_indigenous_land.R b/r-package/R/read_indigenous_land.R index c82692d6..cf74469e 100644 --- a/r-package/R/read_indigenous_land.R +++ b/r-package/R/read_indigenous_land.R @@ -11,6 +11,7 @@ #' @param date Numeric. Date of the data in YYYYMM format. Defaults to `201907`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -21,7 +22,10 @@ #' # Read all indigenous land in an specific date #' i <- read_indigenous_land(date=201907) #' -read_indigenous_land <- function(date=201907, simplified=TRUE, showProgress=TRUE){ +read_indigenous_land <- function(date = 201907, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="indigenous_land", year=date, simplified=simplified) @@ -30,7 +34,9 @@ read_indigenous_land <- function(date=201907, simplified=TRUE, showProgress=TRUE file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_intermediate_region.R b/r-package/R/read_intermediate_region.R index 0b9fca76..c8a738de 100644 --- a/r-package/R/read_intermediate_region.R +++ b/r-package/R/read_intermediate_region.R @@ -14,6 +14,7 @@ #' function downloads all intermediate regions of the country. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -32,7 +33,11 @@ #' im <- read_intermediate_region() #' im <- read_intermediate_region(code_intermediate="all") #' -read_intermediate_region <- function(code_intermediate="all", year=2019, simplified=TRUE, showProgress=TRUE){ +read_intermediate_region <- function(code_intermediate = "all", + year = 2019, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="intermediate_regions", year=year, simplified=simplified) @@ -44,7 +49,9 @@ read_intermediate_region <- function(code_intermediate="all", year=2019, simplif file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_meso_region.R b/r-package/R/read_meso_region.R index dfae90a5..24964dd2 100644 --- a/r-package/R/read_meso_region.R +++ b/r-package/R/read_meso_region.R @@ -11,6 +11,7 @@ #' regions of the country. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -31,7 +32,8 @@ read_meso_region <- function(code_meso = "all", year = 2010, simplified = TRUE, - showProgress = TRUE){ + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="meso_region", @@ -50,7 +52,9 @@ read_meso_region <- function(code_meso = "all", file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -71,7 +75,9 @@ read_meso_region <- function(code_meso = "all", # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_metro_area.R b/r-package/R/read_metro_area.R index 0af08e09..67383d7b 100644 --- a/r-package/R/read_metro_area.R +++ b/r-package/R/read_metro_area.R @@ -14,6 +14,7 @@ #' default), the function downloads all states. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -28,7 +29,8 @@ read_metro_area <- function(year = 2018, code_state = "all", simplified = TRUE, - showProgress = TRUE){ + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="metropolitan_area", year=year, simplified=simplified) @@ -37,7 +39,9 @@ read_metro_area <- function(year = 2018, file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_micro_region.R b/r-package/R/read_micro_region.R index 49002e8c..8bd7abef 100644 --- a/r-package/R/read_micro_region.R +++ b/r-package/R/read_micro_region.R @@ -11,6 +11,7 @@ #' country. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -28,10 +29,11 @@ #' # Read all micro regions at a given year #' micro <- read_micro_region(code_micro="all", year=2010) #' -read_micro_region <- function(code_micro="all", - year=2010, - simplified=TRUE, - showProgress=TRUE){ +read_micro_region <- function(code_micro = "all", + year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="micro_region", year=year, simplified=simplified) @@ -48,7 +50,9 @@ read_micro_region <- function(code_micro="all", file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -68,7 +72,9 @@ read_micro_region <- function(code_micro="all", # download files - sf <- download_gpkg(file_url, showProgress = showProgress) + sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_municipal_seat.R b/r-package/R/read_municipal_seat.R index 17a1b2fd..93300a24 100644 --- a/r-package/R/read_municipal_seat.R +++ b/r-package/R/read_municipal_seat.R @@ -8,6 +8,7 @@ #' #' @param year Numeric. Year of the data in YYYY format. Defaults to `2010`. #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -18,7 +19,9 @@ #' # Read municipal seats in an specific year #' m <- read_municipal_seat(year = 1991) #' -read_municipal_seat <- function(year=2010, showProgress=TRUE){ +read_municipal_seat <- function(year = 2010, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="municipal_seat", year=year, simplified=F) @@ -27,7 +30,9 @@ read_municipal_seat <- function(year=2010, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_municipality.R b/r-package/R/read_municipality.R index 96664a34..8e0c303e 100644 --- a/r-package/R/read_municipality.R +++ b/r-package/R/read_municipality.R @@ -136,7 +136,9 @@ read_municipality <- function(code_muni = "all", if (is.character(code_muni)){ file_url <- as.character(subset(temp_meta, code_abbrev==substr(code_muni, 1, 2))$download_path) } # download files - sf <- download_gpkg(file_url, showProgress = showProgress) + sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_neighborhood.R b/r-package/R/read_neighborhood.R index 0c42a916..737a048b 100644 --- a/r-package/R/read_neighborhood.R +++ b/r-package/R/read_neighborhood.R @@ -8,6 +8,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2010`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -18,7 +19,10 @@ #' # Read neighborhoods of Brazilian municipalities #' n <- read_neighborhood(year=2010) #' -read_neighborhood <- function(year=2010, simplified=TRUE, showProgress=TRUE){ +read_neighborhood <- function(year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="neighborhood", year=year, simplified=simplified) @@ -27,7 +31,9 @@ read_neighborhood <- function(year=2010, simplified=TRUE, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_pop_arrangements.R b/r-package/R/read_pop_arrangements.R index 98c54670..58524e78 100644 --- a/r-package/R/read_pop_arrangements.R +++ b/r-package/R/read_pop_arrangements.R @@ -9,6 +9,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2015`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -19,7 +20,10 @@ #' # Read urban footprint of Brazilian cities in an specific year #' uc <- read_pop_arrangements(year=2015) #' -read_pop_arrangements <- function(year=2015, simplified=TRUE, showProgress=TRUE){ +read_pop_arrangements <- function(year = 2015, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="pop_arrengements", year=year, simplified=simplified) @@ -28,7 +32,9 @@ read_pop_arrangements <- function(year=2015, simplified=TRUE, showProgress=TRUE) file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_region.R b/r-package/R/read_region.R index 2376dffa..a3830fc7 100644 --- a/r-package/R/read_region.R +++ b/r-package/R/read_region.R @@ -6,7 +6,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2010`. #' @template simplified #' @template showProgress -#' +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -19,7 +19,8 @@ #' read_region <- function(year = 2010, simplified = TRUE, - showProgress = TRUE){ + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="regions", year=year, simplified=simplified) @@ -28,7 +29,9 @@ read_region <- function(year = 2010, file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_schools.R b/r-package/R/read_schools.R index adf0902b..c35f87e1 100644 --- a/r-package/R/read_schools.R +++ b/r-package/R/read_schools.R @@ -11,6 +11,7 @@ #' #' @param year Numeric. Year of the data in YYYY format. Defaults to `2020`. #' @template showProgress +#' @template cache #' #' #' @return An `"sf" "data.frame"` object @@ -22,7 +23,9 @@ #' # Read all schools in the country #' s <- read_schools( year = 2020) #' -read_schools <- function(year=2020, showProgress=TRUE ){ +read_schools <- function(year = 2020, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="schools", year=year, simplified=F) @@ -31,7 +34,9 @@ read_schools <- function(year=2020, showProgress=TRUE ){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_semiarid.R b/r-package/R/read_semiarid.R index 42a20ab4..a6d5f3e4 100644 --- a/r-package/R/read_semiarid.R +++ b/r-package/R/read_semiarid.R @@ -8,7 +8,7 @@ #' @param year Numeric. Year of the data in YYYY format. Defaults to `2017`. #' @template simplified #' @template showProgress -#' +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -19,7 +19,10 @@ #' # Read Brazilian semiarid #' a <- read_semiarid(year=2017) #' -read_semiarid <- function(year=2017, simplified=TRUE, showProgress=TRUE){ +read_semiarid <- function(year = 2017, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="semiarid", year=year, simplified=simplified) @@ -28,7 +31,9 @@ read_semiarid <- function(year=2017, simplified=TRUE, showProgress=TRUE){ file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_state.R b/r-package/R/read_state.R index 4649cb03..846fab2b 100644 --- a/r-package/R/read_state.R +++ b/r-package/R/read_state.R @@ -9,6 +9,7 @@ #' default), the function downloads all states. #' @template simplified #' @template showProgress +#' @template cache #' #' #' @return An `"sf" "data.frame"` object @@ -29,7 +30,8 @@ read_state <- function(code_state = "all", year = 2010, simplified = TRUE, - showProgress = TRUE){ + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="state", year=year, simplified=simplified) @@ -57,7 +59,9 @@ if( x < 1992){ file_url <- as.character(temp_meta$download_path) # download gpkg - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -70,7 +74,9 @@ if( x < 1992){ file_url <- as.character(temp_meta$download_path) # download gpkg - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -93,7 +99,9 @@ if( x < 1992){ file_url <- as.character(temp_meta$download_path) # download gpkg - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -112,7 +120,9 @@ if( x < 1992){ # download gpkg - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_statistical_grid.R b/r-package/R/read_statistical_grid.R index faed38c8..d42edf85 100644 --- a/r-package/R/read_statistical_grid.R +++ b/r-package/R/read_statistical_grid.R @@ -12,6 +12,7 @@ #' grid quadrant id to load an specific quadrant. Quadrant ids #' can be consulted at `geobr::grid_state_correspondence_table`. #' @template showProgress +#' @template cache #' #' #' @return An `"sf" "data.frame"` object @@ -26,7 +27,10 @@ #' # Read the grid covering a given state at a given year #' state_grid <- read_statistical_grid(code_grid = "RJ") #' -read_statistical_grid <- function(code_grid, year=2010, showProgress=TRUE){ # nocov start +read_statistical_grid <- function(code_grid, + year = 2010, + showProgress = TRUE, + cache = TRUE){ # nocov start # Get metadata with data url addresses temp_meta <- select_metadata(geography="statistical_grid", year=year, simplified=F) @@ -50,7 +54,9 @@ read_statistical_grid <- function(code_grid, year=2010, showProgress=TRUE){ # no file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -84,7 +90,9 @@ read_statistical_grid <- function(code_grid, year=2010, showProgress=TRUE){ # no file_url <- as.character(subset(temp_meta, code %in% grid_ids)$download_path) # download gpkg - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -102,7 +110,9 @@ read_statistical_grid <- function(code_grid, year=2010, showProgress=TRUE){ # no file_url <- as.character(subset(temp_meta, code== code_grid)$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_urban_area.R b/r-package/R/read_urban_area.R index fa30f5c9..3fceec41 100644 --- a/r-package/R/read_urban_area.R +++ b/r-package/R/read_urban_area.R @@ -12,6 +12,7 @@ #' default), the function downloads all states. #' @template simplified #' @template showProgress +#' @template cache #' #' #' @return An `"sf" "data.frame"` object @@ -26,7 +27,8 @@ read_urban_area <- function(year = 2015, code_state = "all", simplified = TRUE, - showProgress = TRUE){ + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="urban_area", year=year, simplified=simplified) @@ -35,7 +37,9 @@ read_urban_area <- function(year = 2015, file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_urban_concentrations.R b/r-package/R/read_urban_concentrations.R index 6196249f..2e0d0e5d 100644 --- a/r-package/R/read_urban_concentrations.R +++ b/r-package/R/read_urban_concentrations.R @@ -9,6 +9,7 @@ #' @param year Numeric. A year number in YYYY format. Defaults to `2015`. #' @template simplified #' @template showProgress +#' @template cache #' #' #' @return An `"sf" "data.frame"` object @@ -20,7 +21,10 @@ #' # Read urban footprint of Brazilian cities in an specific year #' uc <- read_urban_concentrations(year=2015) #' -read_urban_concentrations <- function(year=2015, simplified=TRUE, showProgress=TRUE){ +read_urban_concentrations <- function(year = 2015, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="urban_concentrations", year=year, simplified=simplified) @@ -29,7 +33,9 @@ read_urban_concentrations <- function(year=2015, simplified=TRUE, showProgress=T file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/R/read_weighting_area.R b/r-package/R/read_weighting_area.R index 6b261f3a..141673ee 100644 --- a/r-package/R/read_weighting_area.R +++ b/r-package/R/read_weighting_area.R @@ -10,6 +10,7 @@ #' @param year Numeric. Year of the data. Defaults to `2010`. #' @template simplified #' @template showProgress +#' @template cache #' #' @return An `"sf" "data.frame"` object #' @@ -32,7 +33,11 @@ #' # Read all weighting areas of the country at a given year #' w <- read_weighting_area(code_weighting="all", year=2010) #' -read_weighting_area <- function(code_weighting="all", year=2010, simplified=TRUE, showProgress=TRUE){ +read_weighting_area <- function(code_weighting = "all", + year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE){ # Get metadata with data url addresses temp_meta <- select_metadata(geography="weighting_area", year=year, simplified=simplified) @@ -48,7 +53,9 @@ read_weighting_area <- function(code_weighting="all", year=2010, simplified=TRUE file_url <- as.character(temp_meta$download_path) # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } @@ -67,7 +74,9 @@ read_weighting_area <- function(code_weighting="all", year=2010, simplified=TRUE if (is.character(code_weighting)){ file_url <- as.character(subset(temp_meta, code_abbrev==substr(code_weighting, 1, 2))$download_path) } # download files - temp_sf <- download_gpkg(file_url, showProgress = showProgress) + temp_sf <- download_gpkg(file_url = file_url, + showProgress = showProgress, + cache = cache) # check if download failed if (is.null(temp_sf)) { return(invisible(NULL)) } diff --git a/r-package/cran-comments.md b/r-package/cran-comments.md index 3bf6d1cf..3f64e3c3 100644 --- a/r-package/cran-comments.md +++ b/r-package/cran-comments.md @@ -1,7 +1,7 @@ # geobr v1.9.9999999999 -── R CMD check results ────────────────────────────────────────────────────────────── geobr 1.9.0 ──── -Duration: 8m 56.3s +── R CMD check results ──────────────────────────────────────────────── geobr 1.9.0 ──── +Duration: 8m 51s ❯ checking data for non-ASCII characters ... NOTE Note: found 58 marked UTF-8 strings diff --git a/r-package/man/read_amazon.Rd b/r-package/man/read_amazon.Rd index 4cb30185..381eaeb3 100644 --- a/r-package/man/read_amazon.Rd +++ b/r-package/man/read_amazon.Rd @@ -4,7 +4,7 @@ \alias{read_amazon} \title{Download spatial data of Brazil's Legal Amazon} \usage{ -read_amazon(year = 2012, simplified = TRUE, showProgress = TRUE) +read_amazon(year = 2012, simplified = TRUE, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2012}.} @@ -17,6 +17,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_biomes.Rd b/r-package/man/read_biomes.Rd index bb9dd7d1..7dade9f7 100644 --- a/r-package/man/read_biomes.Rd +++ b/r-package/man/read_biomes.Rd @@ -4,7 +4,7 @@ \alias{read_biomes} \title{Download spatial data of Brazilian biomes} \usage{ -read_biomes(year = 2019, simplified = TRUE, showProgress = TRUE) +read_biomes(year = 2019, simplified = TRUE, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2019}.} @@ -17,6 +17,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_census_tract.Rd b/r-package/man/read_census_tract.Rd index 16f1d9e8..dbc254d9 100644 --- a/r-package/man/read_census_tract.Rd +++ b/r-package/man/read_census_tract.Rd @@ -9,7 +9,8 @@ read_census_tract( year = 2010, zone = "urban", simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -32,6 +33,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_comparable_areas.Rd b/r-package/man/read_comparable_areas.Rd index 21b2de21..6016748f 100644 --- a/r-package/man/read_comparable_areas.Rd +++ b/r-package/man/read_comparable_areas.Rd @@ -8,7 +8,8 @@ read_comparable_areas( start_year = 1970, end_year = 2010, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -26,6 +27,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_conservation_units.Rd b/r-package/man/read_conservation_units.Rd index 273b60d3..05635efe 100644 --- a/r-package/man/read_conservation_units.Rd +++ b/r-package/man/read_conservation_units.Rd @@ -4,7 +4,12 @@ \alias{read_conservation_units} \title{Download spatial data of Brazilian environmental conservation units} \usage{ -read_conservation_units(date = 201909, simplified = TRUE, showProgress = TRUE) +read_conservation_units( + date = 201909, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{date}{Numeric. Date of the data in YYYYMM format. Defaults to \code{201909}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_country.Rd b/r-package/man/read_country.Rd index 2b326be3..bd89abad 100644 --- a/r-package/man/read_country.Rd +++ b/r-package/man/read_country.Rd @@ -4,7 +4,7 @@ \alias{read_country} \title{Download spatial data of Brazil's national borders} \usage{ -read_country(year = 2010, simplified = TRUE, showProgress = TRUE) +read_country(year = 2010, simplified = TRUE, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2010}.} @@ -17,6 +17,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_disaster_risk_area.Rd b/r-package/man/read_disaster_risk_area.Rd index 7c735040..2ccec00c 100644 --- a/r-package/man/read_disaster_risk_area.Rd +++ b/r-package/man/read_disaster_risk_area.Rd @@ -4,7 +4,12 @@ \alias{read_disaster_risk_area} \title{Download spatial data of disaster risk areas} \usage{ -read_disaster_risk_area(year = 2010, simplified = TRUE, showProgress = TRUE) +read_disaster_risk_area( + year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2010}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_health_facilities.Rd b/r-package/man/read_health_facilities.Rd index ff048aef..63aba5b4 100644 --- a/r-package/man/read_health_facilities.Rd +++ b/r-package/man/read_health_facilities.Rd @@ -4,13 +4,19 @@ \alias{read_health_facilities} \title{Download geolocated data of health facilities} \usage{ -read_health_facilities(date = 202303, showProgress = TRUE) +read_health_facilities(date = 202303, showProgress = TRUE, cache = TRUE) } \arguments{ \item{date}{Numeric. Date of the data in YYYYMM format. Defaults to \code{202303}, which was the latest data available by the time of this update.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_health_region.Rd b/r-package/man/read_health_region.Rd index e3bcdfca..82ffac3d 100644 --- a/r-package/man/read_health_region.Rd +++ b/r-package/man/read_health_region.Rd @@ -8,7 +8,8 @@ read_health_region( year = 2013, macro = FALSE, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -26,6 +27,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_immediate_region.Rd b/r-package/man/read_immediate_region.Rd index 6aee84ca..a31e5160 100644 --- a/r-package/man/read_immediate_region.Rd +++ b/r-package/man/read_immediate_region.Rd @@ -8,7 +8,8 @@ read_immediate_region( code_immediate = "all", year = 2019, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -28,6 +29,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_indigenous_land.Rd b/r-package/man/read_indigenous_land.Rd index bb727b3e..82db05f4 100644 --- a/r-package/man/read_indigenous_land.Rd +++ b/r-package/man/read_indigenous_land.Rd @@ -4,7 +4,12 @@ \alias{read_indigenous_land} \title{Download spatial data of indigenous lands in Brazil} \usage{ -read_indigenous_land(date = 201907, simplified = TRUE, showProgress = TRUE) +read_indigenous_land( + date = 201907, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{date}{Numeric. Date of the data in YYYYMM format. Defaults to \code{201907}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_intermediate_region.Rd b/r-package/man/read_intermediate_region.Rd index 699ffc10..c68b7df5 100644 --- a/r-package/man/read_intermediate_region.Rd +++ b/r-package/man/read_intermediate_region.Rd @@ -8,7 +8,8 @@ read_intermediate_region( code_intermediate = "all", year = 2019, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -28,6 +29,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_meso_region.Rd b/r-package/man/read_meso_region.Rd index fbd0aad2..48b4c6b2 100644 --- a/r-package/man/read_meso_region.Rd +++ b/r-package/man/read_meso_region.Rd @@ -8,7 +8,8 @@ read_meso_region( code_meso = "all", year = 2010, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -28,6 +29,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_metro_area.Rd b/r-package/man/read_metro_area.Rd index 7ae8bf68..791ce532 100644 --- a/r-package/man/read_metro_area.Rd +++ b/r-package/man/read_metro_area.Rd @@ -8,7 +8,8 @@ read_metro_area( year = 2018, code_state = "all", simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -26,6 +27,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_micro_region.Rd b/r-package/man/read_micro_region.Rd index f6ebc8b6..f3b3a6bf 100644 --- a/r-package/man/read_micro_region.Rd +++ b/r-package/man/read_micro_region.Rd @@ -8,7 +8,8 @@ read_micro_region( code_micro = "all", year = 2010, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -28,6 +29,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_municipal_seat.Rd b/r-package/man/read_municipal_seat.Rd index a6f6f469..1a6b875c 100644 --- a/r-package/man/read_municipal_seat.Rd +++ b/r-package/man/read_municipal_seat.Rd @@ -4,12 +4,18 @@ \alias{read_municipal_seat} \title{Download spatial data of municipal seats (sede dos municipios) in Brazil} \usage{ -read_municipal_seat(year = 2010, showProgress = TRUE) +read_municipal_seat(year = 2010, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2010}.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_neighborhood.Rd b/r-package/man/read_neighborhood.Rd index 5a9cb578..5a7ef2e3 100644 --- a/r-package/man/read_neighborhood.Rd +++ b/r-package/man/read_neighborhood.Rd @@ -4,7 +4,12 @@ \alias{read_neighborhood} \title{Download spatial data of neighborhood limits of Brazilian municipalities} \usage{ -read_neighborhood(year = 2010, simplified = TRUE, showProgress = TRUE) +read_neighborhood( + year = 2010, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2010}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_pop_arrangements.Rd b/r-package/man/read_pop_arrangements.Rd index 06ac74d8..97b4c664 100644 --- a/r-package/man/read_pop_arrangements.Rd +++ b/r-package/man/read_pop_arrangements.Rd @@ -4,7 +4,12 @@ \alias{read_pop_arrangements} \title{Download population arrangements in Brazil} \usage{ -read_pop_arrangements(year = 2015, simplified = TRUE, showProgress = TRUE) +read_pop_arrangements( + year = 2015, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2015}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_region.Rd b/r-package/man/read_region.Rd index 77425d08..86b80b9d 100644 --- a/r-package/man/read_region.Rd +++ b/r-package/man/read_region.Rd @@ -4,7 +4,7 @@ \alias{read_region} \title{Download spatial data of Brazil Regions} \usage{ -read_region(year = 2010, simplified = TRUE, showProgress = TRUE) +read_region(year = 2010, simplified = TRUE, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2010}.} @@ -17,6 +17,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_schools.Rd b/r-package/man/read_schools.Rd index 154d21d9..a0b397c6 100644 --- a/r-package/man/read_schools.Rd +++ b/r-package/man/read_schools.Rd @@ -4,12 +4,18 @@ \alias{read_schools} \title{Download geolocated data of schools} \usage{ -read_schools(year = 2020, showProgress = TRUE) +read_schools(year = 2020, showProgress = TRUE, cache = TRUE) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2020}.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_semiarid.Rd b/r-package/man/read_semiarid.Rd index cbfe2ead..ff44c5f8 100644 --- a/r-package/man/read_semiarid.Rd +++ b/r-package/man/read_semiarid.Rd @@ -4,7 +4,12 @@ \alias{read_semiarid} \title{Download spatial data of the Brazilian Semiarid region} \usage{ -read_semiarid(year = 2017, simplified = TRUE, showProgress = TRUE) +read_semiarid( + year = 2017, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{year}{Numeric. Year of the data in YYYY format. Defaults to \code{2017}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_state.Rd b/r-package/man/read_state.Rd index 0b41f244..612884f1 100644 --- a/r-package/man/read_state.Rd +++ b/r-package/man/read_state.Rd @@ -8,7 +8,8 @@ read_state( code_state = "all", year = 2010, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -26,6 +27,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_statistical_grid.Rd b/r-package/man/read_statistical_grid.Rd index 76c6e0cd..43df4f71 100644 --- a/r-package/man/read_statistical_grid.Rd +++ b/r-package/man/read_statistical_grid.Rd @@ -4,7 +4,12 @@ \alias{read_statistical_grid} \title{Download spatial data of IBGE's statistical grid} \usage{ -read_statistical_grid(code_grid, year = 2010, showProgress = TRUE) +read_statistical_grid( + code_grid, + year = 2010, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{code_grid}{If two-letter abbreviation or two-digit code of a state is @@ -18,6 +23,12 @@ can be consulted at \code{geobr::grid_state_correspondence_table}.} only year available thus far is 2010.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_urban_area.Rd b/r-package/man/read_urban_area.Rd index cad3d207..ebd1d560 100644 --- a/r-package/man/read_urban_area.Rd +++ b/r-package/man/read_urban_area.Rd @@ -8,7 +8,8 @@ read_urban_area( year = 2015, code_state = "all", simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -26,6 +27,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_urban_concentrations.Rd b/r-package/man/read_urban_concentrations.Rd index a2dab8a4..419ab066 100644 --- a/r-package/man/read_urban_concentrations.Rd +++ b/r-package/man/read_urban_concentrations.Rd @@ -4,7 +4,12 @@ \alias{read_urban_concentrations} \title{Download urban concentration areas in Brazil} \usage{ -read_urban_concentrations(year = 2015, simplified = TRUE, showProgress = TRUE) +read_urban_concentrations( + year = 2015, + simplified = TRUE, + showProgress = TRUE, + cache = TRUE +) } \arguments{ \item{year}{Numeric. A year number in YYYY format. Defaults to \code{2015}.} @@ -17,6 +22,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object diff --git a/r-package/man/read_weighting_area.Rd b/r-package/man/read_weighting_area.Rd index 636fa950..14399164 100644 --- a/r-package/man/read_weighting_area.Rd +++ b/r-package/man/read_weighting_area.Rd @@ -8,7 +8,8 @@ read_weighting_area( code_weighting = "all", year = 2010, simplified = TRUE, - showProgress = TRUE + showProgress = TRUE, + cache = TRUE ) } \arguments{ @@ -27,6 +28,12 @@ simplified by removing vertices of borders using \verb{st_simplify\{sf\}} preser topology with a \code{dTolerance} of 100.} \item{showProgress}{Logical. Defaults to \code{TRUE} display progress bar.} + +\item{cache}{Logical. Whether the function should read the data cached +locally, which is faster. Defaults to \code{cache = TRUE}. By default, +\code{geobr} stores data files in a temporary directory that exists only +within each R session. If \code{cache = FALSE}, the function will download +the data again and overwrite the local file.} } \value{ An \verb{"sf" "data.frame"} object