diff --git a/README.Rmd b/README.Rmd index 87c708b..b1a7306 100644 --- a/README.Rmd +++ b/README.Rmd @@ -40,7 +40,37 @@ pak::pak("ipeaGIT/geocodebr") ## Usage -Soon. + +## Usage + +```{r, eval=FALSE} +library(geocodebr) + +# input data +data_path <- system.file("extdata/small_sample.csv", package = "geocodebr") +input_df <- read.csv(data_path) + +# indicate the columns describing the address fields +fields <- setup_address_fields( + logradouro = "nm_logradouro", + numero = "Numero", + cep = "Cep", + bairro = "Bairro", + municipio = "nm_municipio", + estado = "nm_uf" + ) + +# geocode +df <- geocode( + addresses_table = input_df, + address_fields = fields, + n_cores = 1, + progress = TRUE + ) + +``` + + ## Acknowledgement IPEA diff --git a/vignettes/geocodebr.Rmd b/vignettes/geocodebr.Rmd index 0bc5c6f..88fd079 100644 --- a/vignettes/geocodebr.Rmd +++ b/vignettes/geocodebr.Rmd @@ -23,27 +23,31 @@ knitr::opts_chunk$set( Reprex ```{r, eval = FALSE} - library(geocodebr) # open input data -data_path <- system.file("extdata/sample_1.csv", package = "geocodebr") +data_path <- system.file("extdata/small_sample.csv", package = "geocodebr") input_df <- read.csv(data_path) -geo_duck <- geocode_duck2( - input_table = input_df, +# indicate the columns describing the address fields +fields <- setup_address_fields( logradouro = "nm_logradouro", numero = "Numero", - complemento = "Complemento", cep = "Cep", bairro = "Bairro", municipio = "nm_municipio", - estado = "nm_uf", - output_simple = TRUE, - ncores = NULL, - showProgress = TRUE -) - + estado = "nm_uf" + ) + +# geocode +df <- geocode( + addresses_table = input_df, + address_fields = fields, + n_cores = 1, + progress = TRUE + ) + +head(df) ```