[R-pkg-devel] Problem with package containing spatial data

Igor L |gor|@|tu| @end|ng |rom gm@||@com
Wed Feb 8 15:32:36 CET 2023


Hello all,

I'm developing a package that contains spatial data about public safety in
Rio de Janeiro.

The problem is that when I use the usethis::use_data function which
transforms the shapefile data into a file with the .rda extension, I cannot
use the geometry attribute to create a map.

E.g.:

# Raw-data script:

spatial_aisp <- sf::st_read('data-raw/shp_aisp/lm_aisp_2019.shp')

plot(spatial_aisp) # works

# Same data from .rda file after use usethis::use_data(spatial_aisp,
overwrite = TRUE)

x <- ispdata::spatial_aisp

plot(x) # do not work

Error message:
Error in data.matrix(x) :
  'list' object cannot be coerced to type 'double'


This is happening with all spatial data in the package. I'm using lazydata:
true and have already disabled file compression options, but the problem
persists.

Any ideas?

Scripts can be accessed at https://github.com/igorlaltuf/ispdata

Thanks!
-- 
*Igor Laltuf Marques*
Economist (UFF)
Master in Urban and Regional Planning (IPPUR-UFRJ)
Researcher at ETTERN and CiDMob Laboratories
https://igorlaltuf.github.io/

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list