Short answer: it's fine, and you can thank raster
for proceeding to completion instead of failure, and for letting you know that some data were lost.
Long answer:
it will depend on the projection, and in this case it's probably just on the "the edges". what the edge is and how it manifests for a given instance of a given projection family is the "depends" part.
You can see that it's not the centre points of the cells that are lost:
tpoints <- rgdal::project(coordinates(rastertest.longlat), "+proj=eck4")
sum(is.na(tpoints))
#[1] 0
But it probably is the corners, and possibly the edges of very cell. This perhaps shows that raster projects based on the extent of cells, not just their centre points.
rgdal::project(as.matrix(expand.grid(x = c(-180, 0, 180), y = c(-90,0, 90))), "+proj=eck4")
I admit I expected that to be where the missing values come from, so maybe projectRaster
is extending out a little further north and south? Set values there for latitude outside the -90/90 range and you start getting the warning. I'll follow up if I get a chance to explore more.
Finally, you should probably use an explicit ellipsoid or datum parameter, i.e. "+proj=eck4 +ellps=WGS84".
Best Answer
Is not an error message, it's only a warning. Check
?raster::hist
, the default function is:Where
maxpixels
is the subsample for large objectsAn example with EGM2008 2.5' geoid model (EPSG::1027)
Plots are different because subsamples have different size (especially in y-axis). Be careful choosing the right size. If you pretend to use all values (
hist(r, maxpixels=ncell(r))
), you'll be waiting for a long time.I recommend you to check also
histogram()
fromrasterVis
package.