The following functions in the raster package are designed to work with cell indexes.
fun(r, cell)
[adjacentcolFromCellextentFromCellsrasterFromCellsrowColFromCellrowFromCellvalidCellxyFromCellxFromCellyFromCellThe following functions will return cell indexes.
fun(r, query) to return cells
cellFromColcellFromLinecellFromPolygoncellFromRowcellFromRowColcellFromRowColCombinecellFromXYcellsFromExtentfourCellsFromXYOthers
setValues will work as fun(r, vals, index) only for RasterLayerSparseextent(Raster, r1, r2, c1, c2) to crop an extent by row/column