Skip to content

Commit 4540dde

Browse files
committed
v1.8.1
1 parent 8e10d2f commit 4540dde

File tree

5 files changed

+32
-27
lines changed

5 files changed

+32
-27
lines changed

r-package/DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: geobr
33
Title: Download Official Spatial Data Sets of Brazil
4-
Version: 1.8.0
4+
Version: 1.8.1
55
Authors@R: c(person(given="Rafael H. M.", family="Pereira", email="rafa.pereira.br@gmail.com", role=c("aut", "cre"), comment = c(ORCID = "0000-0003-2125-7465")),
66
person(given="Caio Nogueira", family="Goncalves", role=c("aut")),
77
person(given="Paulo Henrique Fernandes de", family="Araujo", role=c("ctb")),

r-package/NEWS.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
# geobr v1.8.1
12

2-
# geobr v1.7.0999 (dev version)
3+
**CRAN request**
4+
- geobr now uses suggested packages conditionally
5+
6+
7+
8+
# geobr v1.8.0
39

410
**New function**
511
- `read_capitals()` to download either a spatial `sf` object with the location of the municipal seats (sede dos municipios) of state capitals, or a `data.frame` with the names of codes of state capitals. [Closes #243](https://github.com/ipeaGIT/geobr/issues/243)

r-package/cran-comments.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
## ── R CMD check results ───────────────────────────────────── geobr 1.8.0 ────
2-
Duration: 8m 3.8s
1+
── R CMD check results ─────────────────────────────────────────────────────────────────────────────── geobr 1.8.1 ────
2+
Duration: 7m 49.9s
33

44
❯ checking data for non-ASCII characters ... NOTE
55
Note: found 58 marked UTF-8 strings
66

77
0 errors ✔ | 0 warnings ✔ | 1 note ✖
88

99

10-
* Update to version v.1.8.0 with one new function and a few bug fixes.
10+
* geobr now uses suggested packages conditionally
1111

r-package/tests/tests_rafa/test_rafa.R

+1-6
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,7 @@ rhub::check_for_cran(show_status = FALSE)
554554
# submit to CRAN -----------------
555555
usethis::use_cran_comments('teste 2222, , asdadsad')
556556

557-
558-
Sys.setenv(NOT_CRAN = "true")
559-
devtools::submit_cran()
560-
561-
562-
557+
1
563558

564559

565560
# build binary --------------------------------

r-package/vignettes/intro_to_geobr.Rmd

+20-16
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ knitr::opts_chunk$set(
1414
eval = identical(tolower(Sys.getenv("NOT_CRAN")), "true"),
1515
out.width = "100%"
1616
)
17+
18+
19+
use_suggested_pkgs <- c((requireNamespace("dplyr")),
20+
(requireNamespace("scales")),
21+
(requireNamespace("ggplot2")),
22+
(requireNamespace("censobr")))
23+
24+
use_suggested_pkgs <- all(use_suggested_pkgs)
1725
```
1826

1927

@@ -36,7 +44,7 @@ devtools::install_github("ipeaGIT/geobr", subdir = "r-package")
3644

3745
Now let's load the libraries we'll use in this vignette.
3846

39-
```{r eval=TRUE, message=FALSE, warning=FALSE, results='hide'}
47+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE, results='hide'}
4048
library(geobr)
4149
library(ggplot2)
4250
library(sf)
@@ -51,7 +59,7 @@ library(dplyr)
5159

5260
The geobr package covers 27 spatial data sets, including a variety of political-administrative and statistical areas used in Brazil. You can view what data sets are available using the `list_geobr()` function.
5361

54-
```{r eval=TRUE, message=FALSE, warning=FALSE}
62+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE}
5563
# Available data sets
5664
datasets <- list_geobr()
5765
@@ -65,7 +73,7 @@ head(datasets)
6573
The syntax of all *geobr* functions operate one the same logic, so the code to download the data becomes intuitive for the user. Here are a few examples.
6674

6775
Download an specific geographic area at a given year
68-
```{r eval=TRUE, message=FALSE, warning=FALSE}
76+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE}
6977
# State of Sergige
7078
state <- read_state(
7179
code_state="SE",
@@ -133,7 +141,7 @@ All functions to download polygon data such as states, municipalities etc. have
133141

134142
Once you've downloaded the data, it is really simple to plot maps using `ggplot2`.
135143

136-
```{r eval=TRUE, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center"}
144+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center"}
137145
# Remove plot axis
138146
no_axis <- theme(axis.title=element_blank(),
139147
axis.text=element_blank(),
@@ -149,13 +157,10 @@ ggplot() +
149157
```
150158

151159

152-
```{r states br, eval=FALSE, echo=FALSE, message=FALSE, out.width='100%'}
153-
knitr::include_graphics("https://github.com/ipeaGIT/geobr/blob/master/r-package/inst/img/states_br.png?raw=true")
154-
```
155160

156161
Plot all the municipalities of a particular state, such as Rio de Janeiro:
157162

158-
```{r eval=TRUE, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center"}
163+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center"}
159164
160165
# Download all municipalities of Rio
161166
all_muni <- read_municipality(
@@ -173,9 +178,6 @@ ggplot() +
173178
174179
```
175180

176-
```{r munis rio, eval=FALSE, echo=FALSE, message=FALSE, out.width='100%'}
177-
knitr::include_graphics("https://github.com/ipeaGIT/geobr/blob/master/r-package/inst/img/munis_rj.png?raw=true")
178-
```
179181

180182
## Thematic maps
181183

@@ -185,7 +187,7 @@ The next step is to combine data from ***geobr*** package with other data sets
185187

186188
First, we need a `data.frame` with estimates of Life Expectancy and merge it to our spatial database. The two-digit abbreviation of state name is our key column to join these two databases.
187189

188-
```{r eval=TRUE, message=FALSE, warning=FALSE, results='hide'}
190+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE, results='hide'}
189191
# Read data.frame with life expectancy data
190192
df <- utils::read.csv(system.file("extdata/br_states_lifexpect2017.csv", package = "geobr"), encoding = "UTF-8")
191193
@@ -200,7 +202,7 @@ states <- dplyr::left_join(states, df, by = c("name_state" = "uf"))
200202

201203
#### Plot thematic map
202204

203-
```{r eval=TRUE, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center" }
205+
```{r eval=use_suggested_pkgs, message=FALSE, warning=FALSE, fig.height = 8, fig.width = 8, fig.align = "center" }
204206
ggplot() +
205207
geom_sf(data=states, aes(fill=ESPVIDA2017), color= NA, size=.15) +
206208
labs(subtitle="Life Expectancy at birth, Brazilian States, 2014", size=8) +
@@ -216,7 +218,9 @@ Following the same steps as above, we can use together **geobr** with our sister
216218

217219
First, we need to download households data from the Brazilian census using the `read_households()` function.
218220

219-
```{r, eval = TRUE}
221+
222+
223+
```{r, eval = use_suggested_pkgs }
220224
library(censobr)
221225
222226
hs <- read_households(year = 2010,
@@ -226,7 +230,7 @@ hs <- read_households(year = 2010,
226230

227231
Now we're going to (a) group observations by municipality, (b) get the number of households connected to a sewage network, (c) calculate the proportion of households connected, and (d) collect the results.
228232

229-
```{r, eval = TRUE, warning = FALSE}
233+
```{r, eval = use_suggested_pkgs, warning = FALSE}
230234
esg <- hs |>
231235
collect() |>
232236
group_by(code_muni) |> # (a)
@@ -239,7 +243,7 @@ head(esg)
239243
```
240244
Now we only need to download the geometries of Brazilian municipalities from **geobr**, merge the spatial data with our estimates and map the results.
241245

242-
```{r, eval = TRUE, warning = FALSE}
246+
```{r, eval = use_suggested_pkgs, warning = FALSE}
243247
# download municipality geometries
244248
muni_sf <- geobr::read_municipality(year = 2010,
245249
showProgress = FALSE)

0 commit comments

Comments
 (0)