tmap icon indicating copy to clipboard operation
tmap copied to clipboard

Problem in `tm_raster()` for stars objects.

Open olivroy opened this issue 4 months ago • 0 comments

I added a tryCatch() condition back in September, but it seems that with data.table 1.15, the warning has intensified. https://github.com/r-tmap/tmap/commit/93d2d9407353a86f4e22005e39f649f6328bc583

I think we should not ignore this warning as it will not be very safe against future versions of data.table.

devtools::load_all("~/Documents/rrr-forks/tmap")
#> ℹ Loading tmap
library(stars)
#> Loading required package: abind
#> Loading required package: sf
#> Linking to GEOS 3.10.2, GDAL 3.4.2, PROJ 7.2.0; sf_use_s2() is TRUE
landsat_stars = read_stars(system.file("raster/landsat.tif", package = "spDataLarge"))
tm_shape(landsat_stars) +
    tm_raster()
#> stars object downsampled to 376 by 476 cells.
#> Warning in value[[3L]](cond): could not rename the data.table
#> Warning: Invalid .internal.selfref detected and fixed by taking a (shallow)
#> copy of the data.table so that := can add this new column by reference. At an
#> earlier point, this data.table has been copied by R (or was created manually
#> using structure() or similar). Avoid names<- and attr<- which in R currently
#> (and oddly) may copy the whole data.table. Use set* syntax instead to avoid
#> copying: ?set, ?setnames and ?setattr. If this message doesn't help, please
#> report your use case to the data.table issue tracker so the root cause can be
#> fixed or this message improved.

Created on 2024-02-23 with reprex v2.1.0

olivroy avatar Feb 23 '24 13:02 olivroy