I am using R for GIS applications with spatstat and related packages. I would like to generate a kernel density raster, which I have already succeeded in doing using the following:
spatialgrid <- as(density(mypattern,5000,eps=50),'SpatialGridDataFrame')
rastergrid <- raster(spatialgrid)
writeRaster(rastergrid, filename=‘/file.tif’,format=‘GTiff’)
However, when I load the resulting raster into QGIS I have issues due to the fact that the cell values are written in scientific notation, rather than as simple numbers.
Based on this question, I tried format(density(),scientific=FALSE)
but that caused a heavy spike in CPU and took a very long time to run, such that I eventually killed the process.
I'd like to find a way to get the density() function to output integer values. Alternatively, perhaps there is a way to convert the dataframe to integer data type?
I see two options here.
options(scipen=99)
to remove scientific notation, as suggested by @dash2.