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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -