I have the following code to re-project my raster data. My problem is that when I change the projection, it seems that the resolution as well as pixel values change. I want to maintain the original file resolution and values.
NOTE THAT: Since some pixels have high values (indicating non-vegetated areas), changing resolution causes somehow to resample the pixels and creating messy pixel values.
library(raster) # Create RasterLayer object r <- raster('C:/test/1.tif') # Define spatial reference sr <- "+proj=utm +zone=16 +datum=WGS84 +units=m " # Project Raster projected_raster <- projectRaster(r, crs = sr) # Write the RasterLayer to disk writeRaster(projected_raster, filename="C:/test/5.tif")