Skip to content

Commit

Permalink
reprex in readme and vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Dec 23, 2024
1 parent 5a6a9fe commit 8a021c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
32 changes: 31 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="https://www.ipea.gov.br"><img src="man/figures/ipea_logo.png" alt="IPEA" align="right" width="300"/></a>

Expand Down
26 changes: 15 additions & 11 deletions vignettes/geocodebr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```


0 comments on commit 8a021c9

Please sign in to comment.