I have a covertype raster layer which is categorical data (1,2,3...19), and I want to change its resolution, coordination system, column numbers and row numbers to fit with other raster layers. But after I did the resample with "ngb" method, it turned out to have continuous numbers, instead of discrete numbers.
The code is like:
covertype<-brick("/Volumes/Covertype/covertype.tif") newproj<-"+proj=utm +zone=47 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" covertype1<-projectRaster(covertype, crs=newproj, res=30) e<-extent(597568.9, 795028.9, 2340412, 2499892) s<-raster(e, nrows=5316, ncols=6582, crs=newproj) covertype2<-resample(covertype1, s, method="ngb")
I thought using method of "ngb" would not yield numbers different from the original raster layers, but "covertype2" has numbers like 10.00000023.
What is wrong here?