qualocep_download() retrieves a validated dataset from
Qual o CEP hosted on the package's
OSF repository.
Qual o CEP is a database of Brazilian addresses and postal codes, geocoded using the Google Geocoding API. Users should verify the year of the data, as some values may be outdated.
When possible, consider using the
geocodebr
package, which provides more up-to-date geocoded information.
Note: This function requires an internet connection to work and the
osfr package to be installed.
Arguments
- file
- (optional) A - characterstring with the path to a Qual o CEP dataset file. If- NULL, the dataset will be downloaded from the package's OSF repository. (default:- NULL).
- pattern
- (optional) A - characterstring with the pattern of the Qual o CEP dataset file to download. Click here to see the available patterns (default:- "2024-11-12.rds").
- force
- (optional) A - logicalflag to force the download of the Qual o CEP dataset file. If- TRUE, the dataset will be downloaded even if it already exists in the temporary directory (default:- FALSE).
Value
A tibble containing the
Qual o CEP with the following columns:
- postal_code: A- charactervector with the postal codes.
- street_type: A- charactervector with the type of streets.
- street_name: A- charactervector with the name of the streets.
- street: A- charactervector with the full name of the streets.
- complement: A- charactervector with the complement of the addresses.
- place: A- charactervector with the place of the addresses.
- neighborhood: A- charactervector with the neighborhoods
- municipality_code: An- integervector with the codes of the Brazilian Institute of Geography and Statistics (IBGE) for Brazilian municipalities.
- municipality: A- charactervector with the name of the municipalities.
- state_code: An- integervector with the codes of the Brazilian Institute of Geography and Statistics (IBGE) for the Brazilian state.
- state: A- charactervector with the name of the states.
- federal_unit: A- charactervector with the abbreviations of the Brazilian federal unit.
- latitude: A- numericvector with the latitude values of the postal codes (retrieved using Google Geocoding API).
- longitude: A- numericvector with the longitude values of the postal codes (retrieved using Google Geocoding API).
Examples
library(curl)
library(dplyr)
# \dontrun{
  if (has_internet()) {
    qualocep_download() |> glimpse()
  }
#> ℹ Downloading Qual o CEP data from OSF
#> ✔ Downloading Qual o CEP data from OSF [12s]
#> 
#> Rows: 1,396,087
#> Columns: 14
#> $ postal_code       <chr> "69945000", "69945959", "69945970", "69935000", "…
#> $ street_type       <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ street_name       <chr> NA, "Avenida Paraná, 296 Clique e Retire Correios…
#> $ street            <chr> "NA NA", "NA Avenida Paraná, 296 Clique e Retire …
#> $ complement        <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ place             <chr> NA, "AC A C Retire", "AC Acrelândia", NA, "AC A B…
#> $ neighborhood      <chr> NA, "Centro", "Centro", NA, "Centro", "Centro", N…
#> $ municipality_code <int> 1200013, 1200013, 1200013, 1200054, 1200054, 1200…
#> $ municipality      <chr> "Acrelândia", "Acrelândia", "Acrelândia", "Assis …
#> $ state_code        <int> 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1…
#> $ state             <chr> "Acre", "Acre", "Acre", "Acre", "Acre", "Acre", "…
#> $ federal_unit      <chr> "AC", "AC", "AC", "AC", "AC", "AC", "AC", "AC", "…
#> $ latitude          <dbl> -10.0764608, -10.0766582, -10.0764270, -10.931854…
#> $ longitude         <dbl> -67.0586512, -67.0557312, -67.0555998, -69.563862…
# }
