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
character
string with the path to a Qual o CEP dataset file. IfNULL
, the dataset will be downloaded from the package's OSF repository. (default:NULL
).- pattern
(optional) A
character
string 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
logical
flag to force the download of the Qual o CEP dataset file. IfTRUE
, 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
: Acharacter
vector with the postal codes.street_type
: Acharacter
vector with the type of streets.street_name
: Acharacter
vector with the name of the streets.street
: Acharacter
vector with the full name of the streets.complement
: Acharacter
vector with the complement of the addresses.place
: Acharacter
vector with the place of the addresses.neighborhood
: Acharacter
vector with the neighborhoodsmunicipality_code
: Aninteger
vector with the codes of the Brazilian Institute of Geography and Statistics (IBGE) for Brazilian municipalities.municipality
: Acharacter
vector with the name of the municipalities.state_code
: Aninteger
vector with the codes of the Brazilian Institute of Geography and Statistics (IBGE) for the Brazilian state.state
: Acharacter
vector with the name of the states.federal_unit
: Acharacter
vector with the abbreviations of the Brazilian federal unit.latitude
: Anumeric
vector with the latitude values of the postal codes (retrieved using Google Geocoding API).longitude
: Anumeric
vector 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 [11.2s]
#>
#> 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…
# }