I use QGIS to visualise my data but I use R when I have to do many treatments on my attribute tables. (package terra
)
But when I write vector data with R, the Na's appear in QGIS attribute table as "nan" when it usually writes "NULL" in grey when the cell is blank. The columns remain considered as real though "nan" values are present.
It is a problem since I can't select attributes by the expressions "field" is null
or "field" = "nan"
.
I tried to replace them with if("field" = "nan", NULL, "field")
without success either.
Do you know a way to change these "nan" to NULL? Preferably on the R side.
terra
. It now writes NULL to files instead of NaN. Although the behavior may depend on the file format you use; and you do not provide much information. Perhaps you can try the development version (1.5-36) that you can install with:install.packages('terra', repos='https://rspatial.r-universe.dev')