You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior of the na.rm=TRUE option in the as.points() and as.polygons() functions when x is a raster stack is not specified in the help page for these functions. It is not clear whether (1) only cells with missing values in all layers are ignored, or (2) a cell is ignored as soon as a value is missing, in any layer of the raster stack. The user has to do a test to know this. It would be more efficient to indicate this behavior in the na.rm entry of the help page.
This is the choice (2) that was made. I wonder now if this is really the best choice. It seems to me that the most common situation is that a user considers any cell with at least one non-NA value in any layer to be worth keeping in the function output.
Moreover, if we want to keep the cells with at least one non-NA value, in the current situation we have first to extract all cells from the raster stack (with the na.rm=FALSE option) and then make the appropriate selection, which is time and volume consuming. Conversely, if the functions as.points() and as.polygons() returned all cells, as soon as they have at least one non-NA value in a layer, it would be quick to then remove the ones that don't have all their values non-NA, if the need arises.
But I guess it's too late to change the behavior of this option, and that the choice has been carefully thought out.
The text was updated successfully, but these errors were encountered:
I have added a new argument, na.all=FALSE (the current behavior). Setting it to TRUE only removes points (or polygons) if the cell is NA in all layers:
The behavior of the
na.rm=TRUE
option in theas.points()
andas.polygons()
functions whenx
is a raster stack is not specified in the help page for these functions. It is not clear whether (1) only cells with missing values in all layers are ignored, or (2) a cell is ignored as soon as a value is missing, in any layer of the raster stack. The user has to do a test to know this. It would be more efficient to indicate this behavior in thena.rm
entry of the help page.This is the choice (2) that was made. I wonder now if this is really the best choice. It seems to me that the most common situation is that a user considers any cell with at least one non-
NA
value in any layer to be worth keeping in the function output.Moreover, if we want to keep the cells with at least one non-
NA
value, in the current situation we have first to extract all cells from the raster stack (with thena.rm=FALSE
option) and then make the appropriate selection, which is time and volume consuming. Conversely, if the functionsas.points()
andas.polygons()
returned all cells, as soon as they have at least one non-NA
value in a layer, it would be quick to then remove the ones that don't have all their values non-NA
, if the need arises.But I guess it's too late to change the behavior of this option, and that the choice has been carefully thought out.
The text was updated successfully, but these errors were encountered: