On 29 December 2025 at 21:34, Rafael H. M. Pereira wrote:
| # code causing the error
| 
| library(aopdata)
| library(ggplot2)
| df <- aopdata::read_population
| <https://ipeagit.github.io/aopdata/reference/read_population.html>(
| city = 'Fortaleza',  year = 2010,  geometry = TRUE,  showProgress =
| FALSE  )

## Are we not just talking about adding a test for null here?

if (!is.null(df)) {
 
| ggplot() +
|   geom_sf(data=subset(df, P001>0), aes(fill=P001), color=NA, alpha=.8) +
|   scale_fill_distiller(palette = "YlOrRd", direction = 1)+
|   labs(title='Population distribution', fill="Total population") +
|   theme_void()

} # -- if (!is.null())

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | [email protected]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to