apply function (Bitwise "and") on each cell of a raster in R? -


what best way "bitwise and" on pixels in raster (maybe using "raster" package)? want check if sixth bit set.

if given integer, use r's bitwand operator. 'and' 32 (has sixth bit set) , see if result 0 or otherwise. example: bitwand(96,32) # 32, has sixth bit set bitwand(192,32) # 0, not have sixth bit set

i tried bitwand(myraster,32l) not work.

thanks! r.

for operations on each cell of raster, can use function calc of library raster. in case, be:

r.test <- calc(myraster, fun = function(x) bitwand(x,32l)) 

Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -